🏡 index : github.com/captn3m0/codechef.git

---
languages_supported:
    - NA
title: BWKNIGHT
category: NA
old_version: true
problem_code: BWKNIGHT
tags:
    - NA
layout: problem
---
###  All submissions for this problem are available. 

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.

<pre>
Sample Input :
3
2 2
2 3
4 5

</pre><pre>
Sample Output :
12
26
312

</pre><pre>
Constraints :
1 <= T <= 10000
1 <= N,M <= 100000
</pre>