def f():
for i in range(3120,4000):
flag = 1
k=i
for j in range(5):
if i%5==1:
i=(i//5)*4
else:
flag=-1
break
if flag==1:
print(k)
f()
def f():
for i in range(3120,4000):
flag = 1
k=i
for j in range(5):
if i%5==1:
i=(i//5)*4
else:
flag=-1
break
if flag==1:
print(k)
f()