SP7200 CAL - Strange Calendar
Description
In a galaxy, far far away, there was a planet, Gringo quite similar to our own. Maybe it is because the planet has a similar "Sun" and "Moon". In Gringo, people use a calendar which is identical to ours. It is said this calendar was made by one of many kings in Gringo's history thousands of years ago. In the legend, it says the king liked programming very much, and at one night he solved a very difficult problem. He was so happy that he wanted to make a new calendar to congratulate. Hence in his calendar, this very midnight with full moon is first second.
In this calendar, names of periods of time are same to ours, like days, months, years, minutes and seconds. In Gringo planet, the planet will reach same position on its revolution around the "Sun" every T1 seconds, the time between two neighbor full moons is T2 seconds and the time between two neighbor midnights is T3 seconds. It's very clear that a year is T1 seconds and a day is T3 seconds. And luckily, T1 is divisible by T3. So a leap year is unnecessary.
But T2 may be not divisible by T3, which is very troublesome. But our king was very clever, he made following rules.
1\. A new day comes when a midnight come.
2\. A new year comes when the planet reaches the same position with the "first midnight" on its revolution around the "Sun". Of course it will be a midnight and a new day will come, too.
3\. When a new day comes, if the "Moon" will be full in this day, a new month will come, too.
4\. When a new year comes, a new month will come, too. The "Moon" may not be full. So the month was called "0th month" of a year, until a new full moon come.
5\. Due to these complex rules, it is very difficult to calculate how many days in a month. Now many people in Gringo are turning to you for help.
**Input**
There are multiple test cases. The first line of input contains an integer T (T
Input Format
N/A
Output Format
N/A