10891089 SUSTech Online Judge
Problem 1089 --"Two Queens" problem

1089: "Two Queens" problem

Time Limit: 1 Sec  Memory Limit: 32 MB
Submit: 7  Solved: 3
[Submit][Status][Web Board]

Description

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.

Input

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

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

Output

Print the number we want.

Sample Input

3
5 5
3 4
2 2

Sample Output

280
40
0

HINT

Source

 

[Submit][Status]