#P8380. Two Hypercubes
Two Hypercubes
Background
Note: The testdata has been strengthened.
Problem Description
There are queries. For each query, given , compute:
$$\Big(\sum_{x=1}^A\sum_{y=1}^B\sum_{z=1}^C[y^x=x^z]\Big)\bmod (10^9+7).$$Input Format
The first line contains a positive integer .
The next lines each contain three positive integers .
Output Format
Output integers , one per line, representing the answers.
3
1 2 3
3 4 5
6 7 8
3
8
15
2
999 9999 99999
2000 20000 200000
101202
202276
Hint
[Sample 1 Explanation]
For the first query , the triples that satisfy the condition are
For the second query , the triples that satisfy the condition are:
$(1,1,1),(1,1,2),(1,1,3),(1,1,4),(1,1,5),(2,2,2),(2,4,4),(3,3,3).$
For the third query , the triples that satisfy the condition are:
$(1,1,1),(1,1,2),(1,1,3),(1,1,4),(1,1,5),(1,1,6),(1,1,7),(1,1,8);$
$(2,2,2),(2,4,4),(3,3,3),(4,2,2),(4,4,4),(5,5,5),(6,6,6).$
[Constraints]
For of the data, .
- :.
- : .
- :.
- :.
- :.
- :No special constraints.
Translated by ChatGPT 5