eolymp
bolt
Try our new interface for solving problems

Fire

Hold of the barge, which has a square with a side of \textbf{С} (\textbf{С} = \textbf{1}..\textbf{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 \textbf{N}. Each cell burns \textbf{1} min, and then the fire is thrown into all adjacent cells via the common side. How many hours (\textbf{G}) and minutes (\textbf{H}) lasted for a fire, if the entire cargo burned? \InputFile Two positive integers \textbf{С} and \textbf{N} (\textbf{N} = \textbf{1}..\textbf{C^2}). \OutputFile Two non-negative integers, \textbf{G} and \textbf{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