## Problem C. Far Eastern Federal Clock ≡

 Author: A. Klenin Time limit: 1 sec Input file: input.txt Memory limit: 256 Mb Output file: output.txt

### Statement

Once upon a time there was a large country with many provinces and a great government. The government noticed that citizens of the furthest province are unhappy, and decided to do something for them.

After a serious sociological research, the government decided that the main problem of the province is the fact that every citizen has to buy his own watch to measure time. Thus the government decided to build a large tower with a giant analog clock on it, so that citizens could look at the common clock and save money on watches.

Many efforts and resources were spent, and finally the clock has been built and officially started in a grand ceremony. As the ceremony finished, people noticed that the clock has a small problem — it measures time incorrectly.

Since all the money allocated to this project was already spent, it was impossible to fix the clock. Instead, the government introduced a new position of Senior Clock Manager, whose responsibility was to adjust the clock by manually moving its hands.

It was decreed that:

• The clock will always be adjusted exactly at midnight.
• During the rest of the day, the clock will be adjusted periodically, every p minutes.
• The difference between the time displayed by the clock and the actual time must never exceed m minutes. Note that the smallest of all possible differences for a given hand positions is picked, for example, if the clock calculated time as 23:50 while the actual time is 00:05, the difference is 15 minutes.

Since the clock hands are very heavy, the Clock Manager's job is not an easy one. To help him, find the period of adjustment minimizing the total distance by which he must move the clock hands throughout the day. The clock has two hands — for minutes and hours. Every minute, the minute hand jumps clockwise by t degrees, and the hour hand jumps by t / 12 degrees. (A correct clock should have t = 6).

An adjustment is made immediately after the jump, and the effort is equal to the sum of angles between the current and the correct positions of both minute and hour hands.

In the first sample, the clock moves twice as fast as it should, so every minute the error is increased by one minute. This requires an adjustment every two minutes.

In the second sample, the clock moves three times as fast as it should, but the acceptable error is much higher. It turns out that every 30 minutes the position of the minute hand coincides with the correct one, so if we choose the interval of 30 minutes, only the hour hand must be moved.

### Input file format

Input file contains floating point number t followed by integer m.

### Output file format

Output file must contain the minimum total effort s in degrees, with an absolute error less than 102, and the corresponding adjustment period p, 1 ≤ p ≤ 24 * 60. If there are several answers with the same total effort, output the one with the maximum p.

### Constraints

0 ≤ t ≤ 104, 1 ≤ m ≤ 104, t has no more than 3 digits after decimal point.

### Sample tests

No. Input file (input.txt) Output file (output.txt)
1
12 1
9360.0000 2

2
18.0 90
1440.0000 30

3
6 1
0.0000 1440


0.038s 0.007s 15