#include <bits/stdc++.h>
using namespace std;
struct Rec {
  int x1, y1, x2, y2;
} r1, r2;
Rec u(Rec a, Rec b) {
  Rec c;
  c.x2 = max(min(a.x1, a.x2), min(b.x1, b.x2));
  c.x1 = min(max(a.x1, a.x2), max(b.x1, b.x2));
  c.y2 = max(min(a.y1, a.y2), min(b.y1, b.y2));
  c.y1 = min(max(a.y1, a.y2), max(b.y1, b.y2));
  return c;
}
long long A(Rec a) {
  if (a.x1 < a.x2) return 0;
  if (a.y1 < a.y2) return 0;
  return max(((long long)(a.x1 - a.x2) + 1) * ((long long)(a.y1 - a.y2) + 1),
             0LL);
}
int main() {
  int t, n, m, x1, y1, x2, y2, U, D, L, R;
  long long ans;
  scanf("%d", &t);
  while (t--) {
    scanf("%d%d%d%d%d%d", &n, &m, &x1, &y1, &x2, &y2);
    ans = (long long)(n)*m;
    n--;
    m--;
    x1--;
    x2--;
    y1--;
    y2--;
    U = n - max(x1, x2);
    D = min(x1, x2);
    R = m - max(y1, y2);
    L = min(y1, y2);
    r1 = (Rec){x1 + U, y1 + R, x1 - D, y1 - L};
    r2 = (Rec){x2 + U, y2 + R, x2 - D, y2 - L};
    ans -= A(r1) + A(r2);
    ans += A(u(r1, r2));
    cout << ans << endl;
  }
  return 0;
}

### Prompt

Please create a solution in Cpp to the following problem:

Petya is the most responsible worker in the Research Institute. So he was asked to make a very important experiment: to melt the chocolate bar with a new laser device. The device consists of a rectangular field of n × m cells and a robotic arm. Each cell of the field is a 1 × 1 square. The robotic arm has two lasers pointed at the field perpendicularly to its surface. At any one time lasers are pointed at the centres of some two cells. Since the lasers are on the robotic hand, their movements are synchronized — if you move one of the lasers by a vector, another one moves by the same vector.

The following facts about the experiment are known: 

  * initially the whole field is covered with a chocolate bar of the size n × m, both lasers are located above the field and are active; 
  * the chocolate melts within one cell of the field at which the laser is pointed; 
  * all moves of the robotic arm should be parallel to the sides of the field, after each move the lasers should be pointed at the centres of some two cells; 
  * at any one time both lasers should be pointed at the field. Petya doesn't want to become a second Gordon Freeman. 



You are given n, m and the cells (x1, y1) and (x2, y2), where the lasers are initially pointed at (xi is a column number, yi is a row number). Rows are numbered from 1 to m from top to bottom and columns are numbered from 1 to n from left to right. You are to find the amount of cells of the field on which the chocolate can't be melted in the given conditions.

Input

The first line contains one integer number t (1 ≤ t ≤ 10000) — the number of test sets. Each of the following t lines describes one test set. Each line contains integer numbers n, m, x1, y1, x2, y2, separated by a space (2 ≤ n, m ≤ 109, 1 ≤ x1, x2 ≤ n, 1 ≤ y1, y2 ≤ m). Cells (x1, y1) and (x2, y2) are distinct.

Output

Each of the t lines of the output should contain the answer to the corresponding input test set.

Examples

Input

2
4 4 1 1 3 3
4 3 1 1 2 2


Output

8
2

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
struct Rec {
  int x1, y1, x2, y2;
} r1, r2;
Rec u(Rec a, Rec b) {
  Rec c;
  c.x2 = max(min(a.x1, a.x2), min(b.x1, b.x2));
  c.x1 = min(max(a.x1, a.x2), max(b.x1, b.x2));
  c.y2 = max(min(a.y1, a.y2), min(b.y1, b.y2));
  c.y1 = min(max(a.y1, a.y2), max(b.y1, b.y2));
  return c;
}
long long A(Rec a) {
  if (a.x1 < a.x2) return 0;
  if (a.y1 < a.y2) return 0;
  return max(((long long)(a.x1 - a.x2) + 1) * ((long long)(a.y1 - a.y2) + 1),
             0LL);
}
int main() {
  int t, n, m, x1, y1, x2, y2, U, D, L, R;
  long long ans;
  scanf("%d", &t);
  while (t--) {
    scanf("%d%d%d%d%d%d", &n, &m, &x1, &y1, &x2, &y2);
    ans = (long long)(n)*m;
    n--;
    m--;
    x1--;
    x2--;
    y1--;
    y2--;
    U = n - max(x1, x2);
    D = min(x1, x2);
    R = m - max(y1, y2);
    L = min(y1, y2);
    r1 = (Rec){x1 + U, y1 + R, x1 - D, y1 - L};
    r2 = (Rec){x2 + U, y2 + R, x2 - D, y2 - L};
    ans -= A(r1) + A(r2);
    ans += A(u(r1, r2));
    cout << ans << endl;
  }
  return 0;
}

```