We will give you a non-negative integer m and a prime number p.
And we define f(i) is the number of pair(x,y) that satisfies (x+y)i≡xi%p and 1≤x≤p−1,1≤y≤m.
Now, you have to calculate the sum ∑p−1i=1if(i).
Maybe the sum is too big,so you only need to output the sum after mod 1e9+7.
And we define f(i) is the number of pair(x,y) that satisfies (x+y)i≡xi%p and 1≤x≤p−1,1≤y≤m.
Now, you have to calculate the sum ∑p−1i=1if(i).
Maybe the sum is too big,so you only need to output the sum after mod 1e9+7.