1662.
If the starlight never fade
时间限制 1000 ms
内存限制 256 MB
We will give you a non-negative integer $m$ and a prime number $p$.
And we define $f\left(i\right)$ is the number of pair$\left(x,y\right)$ that satisfies $\left(x + y\right) ^ {i} \equiv x ^ {i} \% p$ and $1 \leq x \leq p - 1,1 \leq y \leq m$.
Now, you have to calculate the sum $\sum_{i=1}^{p-1}if\left(i\right)$.
Maybe the sum is too big,so you only need to output the sum after mod $1e9+7$.
输入数据
输出数据
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 $1e9+7$.
样例输入
复制
3
5 7
3 11
2 103
\n
· \n
· \n
· \n
样例输出
复制
Case #1: 210
Case #2: 390
Case #3: 50388
· · \n
· · \n
· · \n