Let’s introduce some definitions that will be needed later.
Let ?????(?) be the set of prime divisors of ?. For example, ?????(140)={2,5,7}, ?????(169)={13}.
Let ?(?,?) be the maximum possible integer ?? where ? is an integer such that ? is divisible by ??. For example:
?(45,3)=9 (45 is divisible by 32=9 but not divisible by 33=27),
?(63,7)=7 (63 is divisible by 71=7 but not divisible by 72=49).
Let ?(?,?) be the product of ?(?,?) for all ? in ?????(?). For example:
?(30,70)=?(70,2)⋅?(70,3)⋅?(70,5)=21⋅30⋅51=10,
?(525,63)=?(63,3)⋅?(63,5)⋅?(63,7)=32⋅50⋅71=63.
You have integers ? and ?. Calculate ?(?,1)⋅?(?,2)⋅…⋅?(?,?)mod(109+7).
Input
The only line contains integers ? and ? (2≤?≤109, 1≤?≤1018) — the numbers used in formula.
Output
Print the answer.
Examples
inputCopy
10 2
outputCopy
2
inputCopy
20190929 1605
outputCopy
363165664
inputCopy
947 987654321987654321
outputCopy
593574252
Note
In the first example, ?(10,1)=?(1,2)⋅?(1,5)=1, ?(10,2)=?(2,2)⋅?(2,5)=2.
In the second example, actual value of formula is approximately 1.597⋅10171. Make sure you print the answer modulo (109+7).
In the third example, be careful about overflow issue.
思路:求出x的素因子,求其在1-n中所有数的贡献
#include#include #include #include #include #include #include #include #include<set> #include<string.h> #include #include #include