Code Submission Evaluation System Login

CSES Problem Set

Number Spiral


Task | Statistics


CSES - Number Spiral

Time limit:1.00 s Memory limit:512 MB

A number spiral is an infinite grid whose upper-left square has number 1. Here are the first five layers of the spiral:

Your task is to find out the number in row $y$ and column $x$.

Input

The first input line contains an integer $t$: the number of tests.

After this, there are $t$ lines, and each line contains integers $y$ and $x$.

Output

For each test, print the number in row $y$ and column $x$.

Constraints
Example

Input:
3
2 3
1 1
4 2


Output:
8
1
15