k=int(input())
s=0
for i in range(10000,30001):
a=i//100
b=i//10%1000
c=i%1000
if a%k==0 and b%k==0 and c%k==0:
s+=1
print(i)
if s==0:
print('No')
/**************************************************************
Problem: 1457
User: admin
Language: Python
Result: Accepted
Time:273 ms
Memory:34480 kb
****************************************************************/