#P3362. Cool loves shaxian
Cool loves shaxian
Description
Shaxian is famous for being lavish when paying endorsement (dàiyán) fees. When this Shaxian pays endorsement fees, it uses an exponent . It will pay fees for rounds. In the -th round, it pays money.
Now there are queries. Each query asks: if Cool participates from round to round , how much money will he receive? (It is guaranteed that .)
Since the Shaxian Snacks on South Street is insanely rich, we need to compute the answer modulo .
Input Format
The input contains multiple lines.
The first line contains three integers, (, , ).
The next lines each contain two integers .
Output Format
The output contains lines.
Each line contains one integer, the amount of endorsement fee Cool receives.
10 2 2
4 5
8 10
47
306
1000 0 1
720 720
30
Hint
Sample 1:
.
.
.
Sample 2:
This is essentially the number of divisors of the number ~.
Translated by ChatGPT 5
京公网安备 11011102002149号