favorite We need a little bit of your help to keep things running, click on this banner to learn more


Hold of the barge, which has a square with a side of С (С = 1..1000), divided into numbered from left to right along the lines of unit squares (cells), which contain flammable goods. At midnight due to a thunderstorm lit up the cell with the number N. Each cell burns 1 min, and then the fire is thrown into all adjacent cells via the common side. How many hours (G) and minutes (H) lasted for a fire, if the entire cargo burned?


Two positive integers С and N (N = 1..C2).


Two non-negative integers, G and H (the number of hours and minutes).

Time limit 1 second
Memory limit 64 MiB
Input example #1
3 5
Output example #1
0 3
Author Didkovskiy V.L.
Source Stage III All-Ukrainian School Olympiad 2010-2011, Round 2, Zhytomyr