Little Dima has been assigned a challenging problem by his teacher, Mr. Pickles, as a punishment for misbehaving during class. The problem requires finding all integer solutions for the following equation:
[ x = b \cdot s(x)^a + c ]
where:
( s(x) ) is a function that calculates the sum of the digits of the integer ( x )
( a ), ( b ), and ( c ) are predetermined constant values.
Task
Your task is to help Dima find all integer solutions ( x ) that satisfy the equation with the constraints ( 0 < x < 10^9 ).
Input Format
The first line of the input contains three space-separated integers:
( a ) (1 ≤ ( a ) ≤ 5)
( b ) (1 ≤ ( b ) ≤ 10000)
( c ) (-10000 ≤ ( c ) ≤ 10000)
Output Format
Print an integer ( n ) — the number of solutions found.
Next, print ( n ) integers in increasing order — the solutions of the equation.
Only consider integer solutions that are strictly greater than 0 and strictly less than ( 10^9 ).
Examples
Example 1
Input:
text
3 2 8
Output:
text
3
10 2008 13726
Example 2
Input:
text
1 2 -18
Output:
text
0
Example 3
Input:
text
2 2 -1
Output:
text
4
1 31 337 967
Solution
Please implement the solution in the /app/ directory.
Important: place your implementation at /app/solution.py so the verifier can run it.