Microzoft Calendar 

It is now year 2003. Five years ago some computer companies and some media were threatening people about problems which may occur at century break due to inability of older programs to resolve properly the passing to year 2000. Media restricted themselves to threatening. Software companies offered several solutions, though they were all different from each other. To make the situation even worse, all the solutions had the same, basic drawback - they were simply patches on old system.


Thank God there was a company, which did not accept partial solutions, and all the time was doing its best to make the user's life easier. It was called Microzoft - name not widely recognised in these ancient times. Its imaginative boss felt that it was definitely time for a change. With the next version of revolutionising operating system Doors MKB (Microzoft Knows Better) a new calendar was introduced. It was thought to solve all the nasty problems.


The year is divided into two periods: Gill and Bates. Each period is divided into five months called: Sun, Water, Forest, Mountains and curiously enough - Money. Each month has 36 days and consists of 6 weeks. Consecutive 6-days long weeks are called: First, Second, Third, Fourth, Fifth and Sixth. Remaining 5(6) days do not belong to any of those periods, months nor weeks and are just to celebrate anniversaries of release of historic product Doors MKB. Thus they are called: Feast 1, Feast 2 ... Feast 5/6. Dates in Microzoft's calendar are written in the following way:


<Period>-<Month>-<Week>-<Number of day in the week>-<Year>, for days 1..360

<Name of celebration day>-<Year>, for days 361..365/366


The first day of the first year was 25th June 1998 (day of release of Doors MKB), how it used to be called in old calendar. In the new one leap years happen when their numbers are dividable without any rest by 4 and are not dividable without rest by 100 or are dividable by 400 (That is the way it worked in the old calendar too). For example 4, 8, 400 are leaping years, but 5, 98, 100 are not. Dates before release have also a symbol bd (with stands for ``before Doors") assigned.


Obviously not all the people appreciated the new idea and it was not accepted as a standard immediately. However five years of trials (and especially losses caused by the year 2000) convinced mankind of the greatness of the new calendar. More and more countries and companies switch to the new system. To ease those in trouble Microzoft introduces a new pocket device called Microzoft Calendar Converter. It is your task to program it.


The schedule of weeks and months in the year is presented below:


Days in year Week Month Period
1..6 First Sun Gill
7..12 Second Sun Gill
13..18 Third Sun Gill
19..24 Fourth Sun Gill
25..30 Fifth Sun Gill
31..36 Sixth Sun Gill
37..42 First Water Gill
43..48   Water Gill
........... ...... ....... ......
355..360 Sixth Money Bates
361..365/6 ........... ............. ......

Input 

As input you get in consecutive lines dates given as a string written according to one of the calendars. Dates in the old one are written as YYYY-MM-DD. For simply you are only to write a converter from old to new calendar. If you get the date in new calendar you simply write ``Enter date in old format". End of file is shown as with a line containing only a string END. You can assume that year in old calendar is in range from 1600 to 5000.

Output 

Output should contain lines with converted dates (one date per line).

Sample Input 

1998-06-25
Feast 2-12
1998-06-24
3476-06-21
2000-06-29
END

Sample Output 

Gill-Sun-First-1-1
Enter date in old format
Feast 5-1bd
Feast 3-1478
Gill-Sun-First-6-3



Miguel A. Revilla
2000-01-10