P22338 [CodeChef] TLAPM
提高-
题目描述

Read problems statements in [Mandarin Chinese], [Russian], [Vietnamese] and [Bengali] as well.

Deep wants to become a 7-star coder on CodeChef. To achieve this goal, everyday, he has to solve as many problems as he can. But for the first time since he was new to programming, he wasn't able to solve a single problem and lost his confidence. Can you help him solve the problem so that he gets a new boost to go ahead?

In this problem, you are given a matrix that extends infinitely to the right and down, filled with values as shown below.

Let $(x, y)$ denote the cell in the $x$-th row and $y$-th column. The upper-left cell $(1, 1)$ contains an integer $1$. You begin at the cell $(x_{1}, y_{1})$ and must walk to the cell $(x_{2}, y_{2})$ by only moving right and down. Formally, from the cell $(x, y)$, in one step you can move to the cell $(x+1, y)$ or $(x, y+1)$.

The value of a path is the sum of the values in all visited cells, including $(x_{1}, y_{1})$ and $(x_{2}, y_{2})$. You need to calculate the maximum possible value on the path of a path from $(x_{1}, y_{1})$ to $(x_{2}, y_{2})$.

------ Input ------

The first line contains an integer $T$, the number of test cases. Then the test cases follow.
Each test case contains of a single line of input, four integers $x_{1}$, $y_{1}$, $x_{2}$, $y_{2}$.

------ Output ------
For each test case, output in a single line the maximum possible value of a path from $(x_{1}, y_{1})$ to $(x_{2}, y_{2})$.

------ Constraints ------
$1 ≤ T ≤ 1000$
$1≤ x_{1}≤ x_{2}≤ 1000$
$1≤ y_{1}≤ y_{2}≤ 1000$

----- Sample Input 1 ------
1
1 1 3 3
----- Sample Output 1 ------
32
----- explanation 1 ------
The only way to achieve the maximum possible value is by visiting cells with values $1 \to 3 \to 6 \to 9 \to 13$.

输入格式

见题面

输出格式

见题面

样例输入
1 1 1 3 3
样例输出
32