How many ways are there to place a black and a white Queen on an M * N chessboard such that they do not attack each other?

The two queens are not same.

Submit: 7 Solved: 3

[Submit][Status][Web Board]

How many ways are there to place a black and a white Queen on an M * N chessboard such that they do not attack each other?

The two queens are not same.

The first line contains the integer “t” which indicates the number of test cases. Each of the following t lines contains two integers M and N separated by spaces (M<=N).

t<=30000 , 2<=M <=10^18 ,2<=N<=10^18.

Print the number we want.

```
3
5 5
3 4
2 2
```

```
280
40
0
```