n=int(input()) i=2000 while(i<=n): if((i%4==0) and (i%100!=0)) or (i%400==0): print(i) i+=4