A date is called palindromic if, when written in the form , the result is a palindrome (a number that reads the same forwards and backwards). For example, the date January\ 1,\ 1 is palindromic since it would be written as ; December\ 1,\ 1021 is also palindromic, since it would be written as .
Given a date, you are required to find the next valid date (in chronological order) that is palindromic (according to the definition above). For this problem, a date is considered valid if the year is between and , the month is between and , the day is at least and:
for months , , , , , , : day is not greater than ;
for months , , , : day is not greater than ;
for month : day is not greater than , and can be only during leap years. A year is a leap year if it is divisible by , or divisible by but not by .
The input file contains one date per line: three numbers separated by the character , representing (in order) the day, month, and year. For example, July , would be written as (or , or ). The last line in the input file is empty.
The output file must contain, for each input date, the next valid palindromic date, one date per line. The date format in the output file is : i.e., the separator is , the first digit of the year must never be , and you must always use two digits for the day and month (use instead of , instead of , etc.).
It is guaranteed that all input dates are valid, and that there exists a "next valid palindromic date" for every input date.
Example 1