## GUPTA MECHANICAL

IN THIS WEBSITE I CAN TELL ALL ABOUT TECH. TIPS AND TRICKS APP REVIEWS AND UNBOXINGS ALSO TECH. NEWS .............

## The Attack of Queen CodeChef Solution | CodeChef Problem Solution 2022

Chef has started developing interest in playing chess, and was learning how the Queen moves.

Chef has an empty $N×N$ chessboard. He places a Queen at $\left(X,Y\right)$ and wonders - What are the number of cells that are under attack by the Queen?

Notes:

• The top-left cell is $\left(1,1\right)$, the top-right cell is $\left(1,N\right)$, the bottom-left cell is $\left(N,1\right)$ and the bottom-right cell is $\left(N,N\right)$.

• The Queen can be moved any number of unoccupied cells in a straight line vertically, horizontally, or diagonally.
• The cell on which the Queen is present, is not said to be under attack by the Queen.

### Input Format

• The first line contains a single integer $T$ - the number of test cases. Then the test cases follow.
• The first and only line of each test case contains three integers $N$$X$ and $Y$, as described in the problem statement.

### Output Format

For each test case, output in a single line, the total number of cells that are under attack by the Queen.

### Constraints

• $1\le T\le {10}^{4}$
• $1\le N\le {10}^{6}$
• $1\le X,Y\le N$

### Sample Input 1

5
1 1 1
3 2 2
3 2 1
2 2 2
150 62 41


### Sample Output 1

0
8
6
3
527


### Explanation

Test case 1: The only cell on the board is $\left(1,1\right)$. Since Queen stands on this cell, it is not under attack.

Test case 2: The Queen can attack the following cells: $\left\{\left(1,1\right),\left(1,2\right),\left(1,3\right),\left(2,1\right),\left(2,3\right),\left(3,1\right),\left(3,2\right),\left(3,3\right)\right\}$.

Test case 3: The Queen can attack the following cells: $\left\{\left(1,1\right),\left(1,2\right),\left(2,2\right),\left(2,3\right),\left(3,1\right),\left(3,2\right)\right\}$.

Test case 4: The Queen can attack the following cells: $\left\{\left(1,1\right),\left(1,2\right),\left(2,1\right)\right\}$.