Package for this problem was not updated by the problem writer or Codeforces administration after we’ve upgraded the judging servers. To adjust the time limit constraint, solution execution time will be multiplied by 2. For example, if your solution works for 400 ms on judging servers, then value 800 ms will be displayed and used to determine the verdict.

Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ACM-ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

No tag edit access

B. Laser

time limit per test

1 secondmemory limit per test

64 megabytesinput

standard inputoutput

standard outputPetya 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 (*x*_{1}, *y*_{1}) and (*x*_{2}, *y*_{2}), where the lasers are initially pointed at (*x*_{i} is a column number, *y*_{i} 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*, *x*_{1}, *y*_{1}, *x*_{2}, *y*_{2}, separated by a space (2 ≤ *n*, *m* ≤ 10^{9}, 1 ≤ *x*_{1}, *x*_{2} ≤ *n*, 1 ≤ *y*_{1}, *y*_{2} ≤ *m*). Cells (*x*_{1}, *y*_{1}) and (*x*_{2}, *y*_{2}) 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

Codeforces (c) Copyright 2010-2018 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Feb/18/2018 13:20:49 (d3).

Desktop version, switch to mobile version.

User lists

Name |
---|