[r]

*El Campanar de la Torrassa*
is well known for annoying its neighbors with the sound of its bells.
Recently, this church run short of money,
so the bell with the bass sound was sold.
Now, with just one bell, the priest devised a new scheme.
Every hour, the bell sounds as many times as the hour
(from once to twelve times).
Also, the bell sounds once at one quarter,
again at two quarters, and again at three quarters.

The priest is happy to inform the neighbors that now bells sound lesser times than in the past. For instance, if some lady wakes up in the middle of the night, say at 3:18, she will hear the bell once at 3:30, once at 3:45, and four times at 4:00. Observe that had she has to wait for 42 minutes to exactly know what time it is. Moreover, she hears six bell sounds. (For comparison, with the traditional scheme, the bell sounds thirteen times.)

Write a program to compute the number of minutes that someone who wakes up at h:m has to wait to exactly know the current time (plus/minus twelve hours), and also how many bell sounds he or she hears in the meantime.

Input

Input consists of several cases, each with two integer numbers h and m. Assume 0≤ h≤ 23 and 0≤ m≤ 59.

Output

For every case, print the number of minutes that someone who wakes up at h:m has to wait to exactly know what time it is, and the number of times that the bells sound during this lapse of time.

Public test cases

**Input**

3 18 15 18 3 15 5 0 5 1 0 0 12 0

**Output**

42 6 42 6 45 7 0 5 59 9 0 12 0 12

Information

- Author
- Jordi Petit
- Language
- English
- Other languages
- Catalan
- Official solutions
- C++
- User solutions