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