Time limit: 0.4s
Memory limit: 64MB
Input:
Output:
Two numbers, and , are given. An -tuple is defined as a set of positive integers, not necessarily distinct, where each number is . For example, for and , two valid -tuples can be , , but not or .
Task
Calculate the sum of greatest common divisors (GCDs) for all -tuples, specifically , where is an -tuple, and is the GCD of the values in the tuple. Since the answer can be very large, it will be displayed modulo .
Input data
On the first line, two integers are found, and .
Output data
On the first line, a single integer, the requested result, will be found.
Constraints and clarifications
# | Points | Constraints |
---|---|---|
1 | 13 | |
2 | 23 | |
3 | 24 | , |
4 | 40 | No additional constraints |
Example 1
stdin
3 3
stdout
30
Explanation
Some -tuples, along with their GCD, are:
Example 2
stdin
10 2
stdout
189
Example 3
stdin
13756 1005346
stdout
339396382