Zeke loves to spend time with Penny and likes her. Penny is having an issue to solve a mathematics problem and is confused. She seeks Zeke's help as she feels he could help her with the problem. He finds this problem very simple. The problem is to count the number of unique triplets of different numbers (N1, N2, N3), where Ni could be any positive integer from 1 to Ni, inclusive (i = 1, 2, 3). Here the numbers can not be repeated in a triplet set.

This looks simple right?

But oops !!!! There is a catch here which was missed by Zeke that the numbers N1, N2, N3 could be well up to 10^18. 

Zeke finds it difficult due to large numbers in stake and needs your help for them so that he can give a solution to Penny. You need to find an optimal solution of the number of unique triplets possible which the above conditions satisfied.

Since, the answer could be quite large. Hence you should output it modulo 10^9 + 7. 

Input:

The first line of the input contains an integer T denoting the number of test cases. The description of T test cases follows. 
Each line of a test case contains three space-separated integers N1, N2, N3.
Output:

For each test case, output a single line containing the number of required triples modulo 10^9 + 7.
Constraints
    1 ≤ T ≤ 10^3
    1 ≤ Ni ≤ 10^18
Sample Input:
5
3 3 3
2 3 2
29 11 1994
1 2 3
1 1 50

Sample Output:
6
2
613536
1
0

Explanation

Case 1. We have the following triples composed of different numbers up to 3:

(1, 2, 3)
(1, 3, 2)
(2, 1, 3)
(2, 3, 1)
(3, 1, 2)
(3, 2, 1)

Case 2. Here the triplets are:
(1, 3, 2)
(2, 3, 1)

Case 3. 613536 triplets exist

Case 4. Here the only triplet is (1, 2, 3).

Case 5. The only choice for N1 and for is N2 is 1, so any such triple will have the same numbers which does not satisfy the conditions. Hence, no triplets are possible.

SAMPLE INPUT
5
3 3 3
2 3 2
29 11 1994
1 2 3
1 1 50

SAMPLE OUTPUT
6
2
613536
1
0
t = input()
while t>0:
	t-=1
	a = map(int, raw_input().split())
	a.sort()
	a[1] -= 1
	a[2] -= 2
	if a[0] == 0 or a[1] == 0 or a[2] == 0:
		print "0"
	else:
		print ((((a[0]%1000000007)*a[1])%1000000007)*a[2])%1000000007