import euler
import math

for x in range(3, 1000000):
    if sum(map(math.factorial, euler.get_all_digits(x)))==x:
        print (x)
