Let there be a chessboard of size N×M, and only one bishop in a cell (x, y). How many cells can the bishop can attack in one move? You can assume that one possible move is staying in the current position.
In the first line of input, there will be a number T (1 ≤ T ≤ 1000) denoting the number of test cases.
On the next T lines, there will be four integers N, M, x, y as described above. Here N (1 ≤ N ≤ 1012) is the number of columns and M (1 ≤ M ≤ 1012) is the number of rows. The bishop is at column x (1 ≤ x ≤ N), row y (1 ≤ y ≤ M).
For each test case print a single line with the number of cells the bishop can attack with one move.
2 8 6 2 4 8 6 1 1
The image above is a visualization of the first case.