Time Limit : sec, Memory Limit : KB
English / Japanese  

Japanese Calendar

"The Western calendar" is a concept imported from the West, but in Japan, there is a concept called the Japanese calendar that identifies the year by attaching the year to the Gengo. For example, this year is 2016 in the Western calendar, but Heisei 28 in the Japanese calendar. Both are commonly used ways of expressing the year, but have you ever experienced a situation where you know the Western calendar for a certain year, but don't know what year it is in the Japanese calendar, or vice versa?

Make a program to output the year of the Japanese calendar when the year is given in the Western calendar, or the year of the Western calendar when the year is given in the Japanese calendar. However, the mapping between the Western and Japanese calendars should be as follows for simplicity.

Western calendar Japanese calendar
From 1868 to 1911 From Meiji 1 to Meiji 44
From 1912 to 1925 From Taisho 1 to Taisho 14
From 1926 to 1988 From Showa 1 to Showa 63
From 1989 to 2016 From Heisei 1 to Heisei 28

Input

The input is given in the following format.

E Y

The input consists of one line, where E (0 ≤ E ≤ 4) is the type of calendar given, and Y is the year in that calendar, where E is 0 for the Western calendar year Y (1868 ≤ Y ≤ 2016), 1 for the Japanese calendar year Meiji Y (1 ≤ Y ≤ 44), 2 for the Japanese calendar year Taisho Y (1 ≤ Y ≤ 14), 3 for the Japanese calendar year Showa Y (1 ≤ Y ≤ 63), and 4 for the Japanese calendar year Heisei Y (1 ≤ Y ≤ 28).

Output

Output the result of converting the Western calendar to the Japanese calendar, or the Japanese calendar to the Western calendar, in a line. However, the result of converting the Western calendar to the Japanese calendar is output with the letter "M" for Meiji, "T" for Taisho, "S" for Showa, or "H" for Heisei at the beginning.

Sample Input 1

0 2015

Sample Output 1

H27

Sample Input 2

0 1912

Sample Output 2

T1

Sample Input 3

2 1

Sample Output 3

1912

Sample Input 4

4 28

Sample Output 4

2016