#abc162e. [abc162_e]Sum of gcd of Tuples (Hard)
[abc162_e]Sum of gcd of Tuples (Hard)
Problem Statement
Consider sequences of length consisting of integers between and (inclusive).
There are such sequences. Find the sum of over all of them.
Since this sum can be enormous, print the value modulo .
Here denotes the greatest common divisor of .
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the sum of over all sequences, modulo .
Sample Input 1
3 2
Sample Output 1
9
$\\gcd(1,1,1)+\\gcd(1,1,2)+\\gcd(1,2,1)+\\gcd(1,2,2)$ $+\\gcd(2,1,1)+\\gcd(2,1,2)+\\gcd(2,2,1)+\\gcd(2,2,2)$
Thus, the answer is .
Sample Input 2
3 200
Sample Output 2
10813692
Sample Input 3
100000 100000
Sample Output 3
742202979
Be sure to print the sum modulo .