import math
def calculation(a_a):
for i in range(10000): # до 9999
b = str(a_a)
num = []
q = int(b[0])
w = int(b[1])
e = int(b[2])
r = int(b[3])
if math.fabs(q - r) == w + e:
num.extend(f'{q}{w}{e}{r}')
the_a = 1400
calculation(the_a)
the_a = 1600
calculation(the_a)
print(num)