#D1860. Leap Year
Leap Year
Leap Year
Create a program that outputs all leap years between the year a and year b.
The leap year conditions are as follows. However, 0 <a ≤ b <3,000. If there is no leap year in the given period, output "NA".
- The year is divisible by 4.
- However, a year divisible by 100 is not a leap year.
- However, a year divisible by 400 is a leap year.
Input
Given multiple datasets. The format of each dataset is as follows:
a b
Input ends when both a and b are 0. The number of datasets does not exceed 50.
Output
Print the year or NA for each dataset.
Insert one blank line between the datasets.
Example
Input
2001 2010 2005 2005 2001 2010 0 0
Output
2004 2008
NA
2004 2008
inputFormat
outputFormat
outputs all leap years between the year a and year b.
The leap year conditions are as follows. However, 0 <a ≤ b <3,000. If there is no leap year in the given period, output "NA".
- The year is divisible by 4.
- However, a year divisible by 100 is not a leap year.
- However, a year divisible by 400 is a leap year.
Input
Given multiple datasets. The format of each dataset is as follows:
a b
Input ends when both a and b are 0. The number of datasets does not exceed 50.
Output
Print the year or NA for each dataset.
Insert one blank line between the datasets.
Example
Input
2001 2010 2005 2005 2001 2010 0 0
Output
2004 2008
NA
2004 2008
样例
2001 2010
2005 2005
2001 2010
0 0
2004
2008
NA
2004
2008
</p>