Problem

4 /4


Perpendicular arrows

Problem

The input to the program is two integers  n, m, (\(0<n<=12, 0<=m<60\)) indicating the moment in time " ;n hours m minutes". Determine the smallest number of full minutes after which the hour and minute hands are perpendicular to each other on the dial. Do not use real arithmetic.

Input data: two numbers separated by a space.
Output: Display one number, the answer to the problem.
 
Examples
# Input Output
1 2 50 10
2 12 0  16