#P4345. [SHOI2015] 超能粒子炮·改
[SHOI2015] 超能粒子炮·改
Description
The inventor SHTSC, who once created the Brain-hole Therapy Device and the Super Particle Cannon, has now unveiled his new invention: Super Particle Cannon · Modified — a mysterious device that can fire particle streams with much greater power.
Compared with the Super Particle Cannon, Super Particle Cannon · Modified has a fundamental increase in power. It has two parameters . It fires, at each position numbered from to inclusive, a particle stream with power .
Now SHTSC gives you the parameters of his Super Particle Cannon · Modified. Please compute the remainder modulo of the sum of the powers of the particle streams it fires.
Input Format
The first line contains an integer denoting the number of test cases.
Then follow lines. Each line contains two integers , as described above.
Output Format
Output lines. Each line contains one integer: the value of the sum of the powers modulo .
3
5 5
10 7
1145 14
32
968
763
Hint
For of the testdata, , .
For of the testdata, , .
For of the testdata, , , .
For of the testdata, , .
For of the testdata, , .
Translated by ChatGPT 5
京公网安备 11011102002149号