y=int(input()) for i in range(2000,y+1,4): if i%100!=0 or i%400==0: print(i)