for i in range(10000,100000):
    a=str(i)[0]
    b=str(i)[1:]
    c=str(i)[:2]
    d=str(i)[2:]
    e=str(i)[:3]
    f=str(i)[3:]
    g=str(i)[:4]
    h=str(i)[-1]
    if i==int(a)*int(b)+int(c)*int(d)+int(e)*int(f)+int(g)*int(h):
        print(i,end=" ")