1778. Senior Pan II

时间限制 2000 ms   内存限制 512 MB

20170822184729_37710.jpg
Senior Pan had just failed in his math exam, and he can only prepare to make up for it. So he began a daily task with Master Dong, Dong will give a simple math problem to poor Pan everyday.
But it is still sometimes too hard for Senior Pan, so he has to ask you for help.
Dong will give Pan three integers L,R,K every time, consider all the positive integers in the interval [L,R], you're required to calculate the sum of such integers in the interval that their smallest divisor (other than 1) is K.

输入数据

The first line contains one integer T, represents the number of Test Cases.
Then T lines, each contains three integers L,R,K(1=<L<=R<=10^11,2=<K<=10^11)

输出数据

For every Test Case, output one integer: the answer mod 10^9+7

样例输入

复制
2
1 20 5
2 6 3 \n
 ·  · \n
 · · \n

样例输出

复制
Case #1: 5
Case #2: 3    ·   · \n
    ·   · \n

提交

请先 登录

Source

2017 Multi-University Training Contest - Team 9

© 2024 FAQs Contact About