wuwendi123 @ 2024-10-11 20:08:44
#include <bits/stdc++.h>
using namespace std;
#define int long long
int k[1000005],p[1000005];
int a,b,cnt,ans=1;
int fast_power(int a,int b){
int ans = 1;
while(b){
if(b % 2 == 1){
ans = (ans * a) % 9901;
}
a = (a * a) % 9901;
b >>= 1;
}
return ans%9901;
}
void zhi_fen(int n){
int t = 2;
while(t*t <= n){
if(n % t == 0){
if(k[cnt] != t) cnt++;
k[cnt] = t;
p[cnt] ++;
n /= t;
}else{
t++;
}
}
if(n != 1){
if(k[cnt] != n){
cnt++;
}
k[cnt] = n;
p[cnt]++;
}
}
signed main()
{
cin>>a>>b;
zhi_fen(a);
for(int i=1;i<=cnt;i++){
p[i] *= b;
// p[i] %= 9901;
// cout<<k[i]<<endl;
}
for(int i=1;i<=cnt;i++){
// int cnt = 0;
// for(int j=0;j<=p[i];j++){ // 累加k[i]^0 + k[i]^1 + k[i]^2。。。
// cnt += fast_power(k[i],j);
// cnt %= 9901;
// }
// 等比数列: 首项*(公比^n-1)/(公比-1)
int cnt = (fast_power(k[i],p[i]+1)%9901-1)%9901 / (k[i] - 1)%9901;
ans *= cnt;
ans %= 9901;
}
cout<<ans;
return 0;
}