Little Dima misbehaved during a math lesson a lot and the nasty teacher Mr. Pickles gave him the following problem as a punishment. 

Find all integer solutions x (0 < x < 10^9) of the equation:x = b·s(x)^{a} + c,  

where a, b, c are some predetermined constant values and function s(x) determines the sum of all digits in the decimal representation of number x.

The teacher gives this problem to Dima for each lesson. He changes only the parameters of the equation: a, b, c. Dima got sick of getting bad marks and he asks you to help him solve this challenging problem.


-----Input-----

The first line contains three space-separated integers: a, b, c (1 ≤ a ≤ 5; 1 ≤ b ≤ 10000;  - 10000 ≤ c ≤ 10000).


-----Output-----

Print integer n — the number of the solutions that you've found. Next print n integers in the increasing order — the solutions of the given equation. Print only integer solutions that are larger than zero and strictly less than 10^9.


-----Examples-----
Input
3 2 8

Output
3
10 2008 13726 
Input
1 2 -18

Output
0

Input
2 2 -1

Output
4
1 31 337 967

Difficulty: interview

Starter code:

Solutions:
a, b, c = list(map(int, input().split()))
ans = []
for sum in range(1, 200):
    x = b * sum ** a + c
    if x <= 0 or x >= 10 ** 9:
        continue
    summ = 0
    for aa in str(x):
        summ += int(aa)
    if sum == summ:
        ans.append(x)
print(len(ans))
print(*ans)


ID = input().split()
a = int(ID[0])
b = int(ID[1])
c = int(ID[2])
ans = []

for i in range(1, 82, 1):
    x = b * (i ** a) + c
    if (x > 0 and x < 1000000000):
        y = x
        z = 0
        while (y > 0):
            z += y % 10
            y //= 10
        if (z == i):
            ans.append(x)

print(len(ans))
for x in ans:
    print(x, end = ' ')
    


a,b,c = [int(i) for i in input().split()]

sol = []

for i in range(81):
	d = b*(i**a)+c
	if d <= 0 or d >= 1000000000:
		continue
	if sum([int(j) for j in str(d)]) == i:
		sol.append(d)
print(len(sol))
sol.sort()
for i in sol:
	print(i,end=' ')

def s(x):
    res = 0
    while x > 0:
        res += x % 10
        x //= 10
    return res

a, b, c = list(map(int, input().split()))
ans = []
for i in range(100):
    x = b * (i**a) + c
    if x < 0:
        continue
    if s(x) == i and 0 < x < 10**9:
        ans.append(x);

ans.sort()
print(len(ans))
if len(ans) != 0:
    print(*ans)


3

import sys


def sstevk(n):
    ret = 0
    while n > 0:
        ret += n % 10
        n //= 10
    return ret


def __starting_point():
    a, b, c = list(map(int, sys.stdin.readline().split()))
    sols = []
    for s in range(0, 9*9+1):
        x = b * s**a + c
        if x <= 0 or x >= 10**9:
            continue
        if sstevk(x) == s:
            sols.append(x)
    sols.sort()

    print(len(sols))
    print(' '.join(str(x) for x in sols))

__starting_point()

a, b, c = map(int, input().split())

def sum(x):
    s = 0
    while x > 0:
        s += x % 10
        x = x // 10
    return s
res = []
for i in range(1, 100):
    x = b * i ** a + c
    if x > 0 and x < 10 ** 9  and sum(x) == i:
        res.append(x)
res.sort()
print(len(res))
print(*res)

def main():
    a, b, c = [int(i) for i in input().split()]
    
    result = []
    for S in range(1, 82):
        f = b * S ** a + c
        if 0 < f < 10 ** 9 and sum(int(i) for i in str(f)) == S:
            result.append(str(f))
    
    print(len(result))
    print(' '.join(result))


main()


def sd(n):
    val = 0
    while n > 0:
        val += n % 10
        n //= 10
    return val

a, b, c = (int(x) for x in input().split())
l = []
for s in range(1, 82):
    cur = b * s ** a + c
    if cur > 0 and cur < 10 ** 9 and sd(cur) == s:
        l.append(cur)

l.sort()
print(len(l))
print(' '.join(str(x) for x in l))

def f(y):
    m=0
    while y>0:
        m+=y%10
        y=y//10
    return m


a,b,c=map(int,input().split())
ans=[]
x=1
while x<82:
    k=b*(x**a)+c
    if k<10**9 and f(k)==x: ans.append(k)
    x+=1
print(len(ans))
if len(ans): print(*ans)

import math
a, b, c = map(int, input().split())
ans = []
for i in range(1, 82):
    x = b * (i ** a) + c
    if i == sum(list(map(int, str(abs(x))))) and x < 10 ** 9 and x > 0:
        ans.append(x)
print(len(ans))
if (len(ans)):
    print(*ans)

ans = []
a, b, c = list(map(int, input().split()))

def sumDig(x):
    ret = 0
    if x <= 0:
        return 100500
    while x:
        ret += x % 10
        x //= 10
    return ret 

for s in range(1, 90):
    val = b * pow(s, a) + c
    if 0 < val < 10 ** 9 and sumDig(val) == s:
        ans.append(val)

print(len(ans))
print(' '.join(map(str, sorted(ans))))


"""
Codeforces Contest 262 Div 2 Problem B

Author  : chaotic_iak
Language: Python 3.3.4
"""

def main():
    a,b,c = read()
    res = []
    for i in range(1, 82): # max is 999999999
        x = b * (i**a) + c
        if x <= 0 or x >= 10**9: continue
        if sum(map(int, list(str(x)))) == i: res.append(x)
    res.sort()
    print(len(res))
    print(" ".join(map(str, res)))

################################### NON-SOLUTION STUFF BELOW

def read(mode=2):
    # 0: String
    # 1: List of strings
    # 2: List of integers
    inputs = input().strip()
    if mode == 0: return inputs
    if mode == 1: return inputs.split()
    if mode == 2: return list(map(int, inputs.split()))

def write(s="\n"):
    if s is None: s = ""
    if isinstance(s, list): s = " ".join(map(str, s))
    s = str(s)
    print(s, end="")

write(main())

def s(x):
    tmp = x
    ans = 0
    while tmp > 0:
        ans += tmp % 10
        tmp //= 10
    return ans

def main(a, b, c):
    ans = []
    for i in range(82):
        x = b * (i ** a) + c
        if 0 < x < 10 ** 9 and s(x) == i:
            ans.append(x)
    print(len(ans))
    for i in ans:
        print(i, end = ' ')

a, b, c = map(int, input().split()) 
main(a, b, c)



solutions = []
a,b,c = list(map(int,input().split(" ")))
for s in range(1,82):
    x = b*(s**a)+c;
    if (0<x<10**9):
        if (sum(map(int,list(str(x)))) == s):
            solutions.append(x)
print(len(solutions))
print(" ".join(map(str,solutions)))



x = input()
arr = x.split(' ')
a = (int)(arr[0])
b = (int)(arr[1])
c = (int)(arr[2])

ans = set()

for i in range (1, 82):
    temp = b*(i**a) + c
    temp1 = 0
    temp2 = temp
    while temp>0:
        temp1 = temp1 + (int)(temp%10)
        temp = (int)(temp/10)
        
    #print(temp2)
    #print(temp1)
    if temp2>0 and temp2<1000000000 and temp1 == i:
            ans.add(temp2)
        
print(len(ans));
answer = sorted(ans)

if len(ans)!=0:
    for i in answer:
        print(i , '', end='')

def sum_n(x):
    return sum(map(int, list(str(x))))

a, b, c = list(map(int, input().split()))
result = []
for s in range(1, 82):
    x = b * s ** a + c
    if 0 < x < 10 ** 9 and s == sum_n(x):
        result.append(str(x))
print(len(result))
if len(result):
    print(" ".join(result))


def s(i):
    return sum([int(x) for x in str(i)])

x=[int(i) for i in input().split()]
a=x[0]
b=x[1]
c=x[2]
l=[]
for k in range(1,82):
    n=b*(k**a) +c
    if(n>0 and n<1000000000 and s(n)==k):
        l.append(n)
print(len(l))
for j in l:
    print(j,end=' ')

a, b, c = map(int, input().split())

def sumd(x):
	s = 0
	while x > 0:
		s += x % 10
		x = x // 10
	return s
sol = []
for s in range(1, 82):
	x = b*pow(s, a) + c
	if x > 0 and x < 1000000000 and sumd(x) == s:
		sol.append(x)
print(len(sol))
for el in sorted(sol):
	print(el, end=' ')


a, b, c = map(int, input().split())

def s(x):
    xStr = str(x)
    sum = 0
    for c in xStr:
        sum += int(c)
    return sum


rightSide = []
M = 9*9+1
for k in range(1,M):
    rightSide.append(b*k**a + c)

myList = []
sol = 0
for x in rightSide:
    if(x>0 and x<int(1e9) and x==b*s(x)**a + c):
        sol += 1
        myList.append(x)

myList.sort()
print(sol, end='\n')
for num in myList:
    print(num, sep=' ', end=' ')


import math
def s(x):
    sum = 0
    while x > 0:
        sum += x % 10
        x //= 10
    return sum
a, b, c = map(int,input().split())
ans = []
for i in range(82):
    x = b * i ** a + c
    if x > 0 and x < 10**9 and s(x) == i:
        ans.append(x)
print(len(ans))
if len(ans)>0:
    for x in ans:
        print(x, end=" ")
        

a,b,c= list(map(int,input().split()))

count = 0
arr=[]
def s(x):
    m = str(x)
    k = 0
    for i in m:
        k+=int(i)
    return k
for y in range(1,82):
    p = (b*pow(y,a)+c)
    if p>0 and p<(10**9):
        if s(p)==y:

            count+=1
            arr.append(p)
            #print(p)
print(count)
for x in arr:
    print(x,end=" ")




a, b, c = (int(i) for i in input().split(" "))
import sys
# print(a, b, c)

def calculate(a, b, c, s):
    # print("in calc", a,b,c,s)
    return b * (s ** a) + c
    
def dig_sum(x):
    # print(x)
    line = str(x).strip("-")
    sum = 0
    for i in list(line):
        sum += int(i)
    return sum
    
res = []
for i in range(1, 82):
    x = calculate(a, b, c, i)
    # print(x, dig_sum(x))
    if dig_sum(x) == i:
        res.append(x)

res.sort()
res = [str(i) for i in res if i >= 0 and i < 1000000000]
print(len(res))
print(" ".join(res))
return


m=list(input().split())
a=int(m[0])
b=int(m[1])
c=int(m[2])
from math import floor
sl=""
slc=0

for i in range (1, 81):
    t=b*(i**a)+c
    k=0
    if (t<1)or(t>999999999):
        continue
    kk=str(t)
    for j in range(len(kk)):
        k+=int(kk[j])
    if i==k:
        sl=sl+' '+str(t)
        slc+=1
print(slc)
print(sl[1:])


def sumofdigits(n):
    ans=0
    while n>0:
        ans+=n%10
        n//=10
    return ans
a,b,c=map(int,input().split())
ans=[]
for s in range(1,82):
    d=b*s**a+c
    if sumofdigits(d)==s and 0<d<1000000000:
        ans.append(d)
print(len(ans),'\n',' '.join(map(str,ans)),sep='')

a,b,c = map(int, input().split())
MAXNUM = 10**9 + 1
ans = ''
ansCount = 0

def s(x):
    result = 0
    while (x>0):
        result += x % 10
        x = x // 10
    return result

for i in range (1,82):
    num = b * (i ** a) + c
    if (num > 0 and num < MAXNUM and s(num) == i):
        ans = ans + str(num) + ' '
        ansCount += 1

print(ansCount)
if (ansCount>0):
    print(ans)