#P7451. [2017年杭电多校]If the starlight never fade
[2017年杭电多校]If the starlight never fade
If the starlight never fade
Problem Description
We will give you a non-negative integer and a prime number .
And we define is the number of pair that satisfies and .
Now, you have to calculate the sum .
Maybe the sum is too big,so you only need to output the sum after mod .
Input
The first line contains only one integer , which indicates the number of test cases.
For each test case, there are a integer and a prime number on one line.
Output
For each test case, output one line "Case #x: y", where x is the case number (starting from 1) and y is the sum after mod .
Sample Input
3
5 7
3 11
2 103
Sample Output
Case #1: 210
Case #2: 390
Case #3: 50388
Source
2017 Multi-University Training Contest - Team 2