Four-tuples
题号:NC15932
时间限制:C/C++/Rust/Pascal 2秒,其他语言4秒
空间限制:C/C++/Rust/Pascal 64 M,其他语言128 M
64bit IO Format: %lld

题目描述

Given   ,please count the number of four-tuples such thatand  
The answer should modulo109+7 before output.

输入描述:

The input consists of several test cases. The first
line gives the number of test cases,T(1≤T≤106).

For each test case, the input contains one line
with 8 integers,.

输出描述:

For each test case, output one line containing one
integer, representing the answer.
示例1

输入

复制
1
1 1 2 2 3 3 4 4

输出

复制
1