#P3600. 随机数生成器
随机数生成器
Description
sol developed a magical random number system that can automatically generate true random numbers from environmental noise.
Now sol plans to generate integers in , namely , and then handle some queries.
There are queries. For each query with parameters and , sol will compute (the minimum value of the numbers in the array whose indices are between and ).
Finally, the test result is the maximum among the results of these queries.
sol has conducted many experiments. Now he wants to ask you for the expected value of the test result, modulo .
Input Format
The first line contains three integers .
Each of the next lines contains two integers and .
Output Format
Output a single integer, the answer.
2 2 1
1 2
499967501
6 6 6
1 3
2 4
3 5
4 6
5 6
3 4
88571635
Hint
Tip: The result of a fraction modulo is .
For of the testdata, .
For another of the testdata, .
For of the testdata, .
For of the testdata, .
For of the testdata, , and for each , .
Translated by ChatGPT 5
京公网安备 11011102002149号