ll = []
for num in range(10000, 99999):
    sum = 0
    for j in range(1, 5):
        sum += int(str(num)[:j])*int(str(num)[j:])
    if sum == num:
        ll.append(num)
for i in ll:
    print(i, end=' ')