l1 = list()
for n1 in range(11):
    for n2 in range(10):
        for n3 in range(10):
            for n4 in range(10):
                if n1 ** 3 + n2 ** 3 + n3 ** 3 + n4 ** 3 == n1 * 1000 + n2 * 100 + n3 * 10 + n4:
                    print(int(str(n1) + str(n2) + str(n3) + str(n4)))