ACEAGLE - Eagle and Assassin’s Creed

no tags 

Little Eagle loves to play Assassin’s Creed. One day, he found a strange treasure – a very old clock that has a different property, the minute hand that points to the minutes increases only by 5 minutes, and the hour hand points to the number exactly; they didn’t invent the second hand at this time – He is wondering what’s the minimum angle between the hour hand and the minute hand!.

AC Eagle

Help him to solve this problem.

Note that (3:30) the hour hand points to 3 exactly – not between 3 and 4 – you know it’s a strange treasure.

Input

The first line contains T – the number of test cases. Each test case consists of a single line containing 2 integers H (1 <= H <= 12) and M (0 <= M <= 55).

Output

For each test case, print the solution of the problem.

Example

Input:
2
10 10
6 15

Output:
120
90


Added by:eagle93
Date:2014-06-24
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64