P13443 [CodeChef] bwknight
普及
题目描述

How many ways are there to place a black and a white knight on an N * M chessboard such that they do not attack each other? The knights have to be placed on different squares. A knight can move two squares horizontally and one square vertically, or two squares vertically and one square horizontally. The knights attack each other if one can reach the other in one move.

Input :

The first line contains the number of test cases T. Each of the next T lines contains two integers N and M.

Output :

Output T lines, one for each test case, each containing the required answer for the corresponding test case.

Sample Input :
3
2 2
2 3
4 5

Sample Output :
12
26
312

Constraints :
1 <= T <= 10000
1 <= N,M <= 100000

输入格式

见题面

输出格式

见题面

样例输入
3 2 2 2 3 4 5
样例输出
12 26 312