A plot of land can be described by $M x N$ dots such that horizontal and vertical distance between any two dots is 10m.
Mr. Wolf would like to build a house in the land such that all four sides of the house are equal. Help Mr. Wolf to find the total number of unique positions where houses can be built. Two positions are different if and only if their sets of four dots are different.

-----Input:-----
The first line of the input gives the number of test cases, $T$. $T$ lines follow. Each line has two integers $M$ and $N$: the number of dots in each row and column of the plot, respectively.

-----Output:-----
For each test case, output one single integer containing the total number of different positions where the house can be built.

-----Constraints-----
- $1 \leq T \leq 100$
- $2 \leq M \leq 10^9$
- $2 \leq N \leq 10^9$

-----Sample Input:-----
4

2 4

3 4

4 4

1000 500  

-----Sample Output:-----
3

10

20

624937395  

-----EXPLANATION:-----
Map 1

Map 2

Map 3

Source: codechef | Difficulty: UNKNOWN_DIFFICULTY


Solutions:
from sys import stdin, stdout, setrecursionlimit
from math import ceil
mod = 1000000007
t = int(stdin.readline())
for _ in range(t):
	(m, n) = list(map(int, input().split()))
	if m < n:
		(m, n) = (n, m)
	y = n - 1
	s1 = y * (y + 1) // 2 % mod
	s2 = y * (y + 1) * (2 * y + 1) // 6 % mod
	s3 = y * y * (y + 1) * (y + 1) // 4 % mod
	ans = (m * n * s1 - (m + n) * s2 + s3) % mod
	print(ans)


mod = 1000000007
t = int(input())
for _ in range(t):
	(m, n) = list(map(int, input().split()))
	x = min(m, n)
	f1 = m * n % mod
	s1 = x * (x - 1) // 2 % mod
	f2 = (m + n) % mod
	s2 = x * (x - 1) * (2 * x - 1) // 6 % mod
	s3 = s1 * s1 % mod
	ans = (f1 * s1 % mod - f2 * s2 % mod + s3) % mod
	print(ans)


t = int(input())
e = 10 ** 9 + 7
for _ in range(t):
	(a, b) = list(map(int, input().split()))
	a -= 1
	b -= 1
	c = min(a, b)
	x = c * (c + 1) // 2
	c -= 1
	xx = c * (c + 1) // 2
	(y, z) = (c * (c + 1) * (2 * c + 1) // 6, xx * xx)
	ans = x * a * b + y + z
	ans -= (xx + y) * (a + b)
	print(ans % e)