#P7501. [2017年杭电多校]All Kill
[2017年杭电多校]All Kill
All Kill
Problem Description
Give nonnegative integers which are less than , calculate . HazelFan wants to know how many sextuples are there, satisfies $\gcd(y_{a,b},y_{c,d})=\gcd(y_{c,d},y_{e,f})=\gcd(y_{e,f},y_{a,b})=1$, module .
Input
The first line contains a positive integer , denoting the number of test cases. For each test case: The first line contains a positive integer . The second line contains nonnegative integers .
Output
For each test case: A single line contains a nonnegative integer, denoting the answer.
Sample Input
2
1
1
5
1 2 3 4 5
Sample Output
1
1087
Source
2017 Multi-University Training Contest - Team 7