Time Limit: 3000 MS Memory Limit: 65536 K

## Description

GLC has developed an algorithm to map each lattice point in the 2-d catesian coordinates to a nature number. For example:
(0, 0) -> 0
(1, 0) -> 1
(1, 1) -> 2
(0, 1) -> 3
(-1, 1)-> 4
...
and so on. If we connect every two adjacent points by a segment, we get a spiral line which starts at (0, 0).
Now, given a point on the plane, you are to find the nature number it mapped to.
## Input

The first line of input is the number of test case.
For each test case, thers is only one line contains two number x , y ( |x|, |y| <= 10,000 ).
## Output

for each test case, output the answer in one line.
## Sample Input

2
2 3
3 4
## Sample Output

31
57
## Source

baihacker&onmylove@scuacm
Sichuan University Programming Contest 2012 Final