#P3704. [SDOI2017] 数字表格
[SDOI2017] 数字表格
Description
Doris used her teacher’s supercomputer to generate an table.
The number in the -th row and the -th column is , where denotes the greatest common divisor of and .
There are numbers in total in Doris’s table. She wants to know the product of all these numbers.
Output the answer modulo .
Input Format
There are multiple test cases in a single test file.
The first line contains an integer , the number of test cases.
Each of the next lines contains two integers , describing one test case.
Output Format
For each test case, output one integer on a separate line representing the answer.
3
2 3
4 5
6 7
1
6
960
Hint
Constraints:
- For of the testdata, .
- For of the testdata, .
- For another of the testdata, .
- For of the testdata, , .
Translated by ChatGPT 5
京公网安备 11011102002149号