clock-mania-1
Source: hackerearth
Difficulty: UNKNOWN_DIFFICULTY

In Subodh's CS Deparment there is a contest of Geometry. In this contest students are told to find minimum angle between hour and minute hand.

Input:
The first line contains the number of test cases, T. T lines follow, each of which contains two integer Hour hand H and minute hand M .

Output:
Print the minimum angle between the hands.

Constraints
1 ≤ T ≤ 100 
01 ≤ H ≤ 12
01 ≤ M ≤ 59 

SAMPLE INPUT
2
12 30
06 00

SAMPLE OUTPUT
165 
180

Explanation

In first input time is 12:30 i.e. hour hand is in middle of 12 and 1 & minute hand is pointing at 6 which makes angle of 165 degrees. 

In Second input time is 06:00 i.e. hour hand is at 12 and minute hand is at 6 which makes angle of 180 degrees.


t=eval(input())
for _ in range(t):
	h,m=list(map(int, input().split()))
	h,m=h%12,m%60
	ans=abs((h*60+m)/2-m*6)
	if ans>180:
		ans=360-ans
	print(ans)


def abso(x):
	if x>0:
		return x
	else:
		return (-x)
r=0
t=0
for _ in range(eval(input())):
	
	x,y=list(map(int,input().split()))
	if x==12:
		x=0
   
	x=(x*30)+(y/2)
	y=y*6
   
   
	t=(y-x)
   
	r=abso(t)
	if r>180:
		print(360-r)
	else :
		print(r)
	


T=eval(input())
for _ in range(T):
	h,m=list(map(int,input().split()))
	mangle=360*m/60
	hangle=360*h/12+360*m/12/60
	x=abs(hangle-mangle)
	x=round(x)
	if x==int(x):
		x=int(x)
	if x<180: print(x)
	else: print(360-x)