Pagini recente » Cod sursa (job #720931) | Cod sursa (job #1466917) | Cod sursa (job #2010762) | Cod sursa (job #1042972) | Cod sursa (job #1260098)
#include<stdio.h>
#include<math.h>
#define LL long long
const int MOD = 9901, NMAX = 30;
int nfact;
LL f[NMAX], p[NMAX];
LL lgPow (LL x, LL expo) {
if(expo == 0)
return 1;
if(expo & 1)
return (x * lgPow(x, expo - 1)) % MOD;
LL half = lgPow(x, expo / 2);
return (half * half) % MOD;
}
void fact (LL n) {
LL d, lim, e;
lim = sqrt(n);
d = 2;
while(n > 1 && d <= lim) {
e = 0;
while(n % d == 0)
++ e,
n /= d;
if(e) {
++ nfact;
f[nfact] = d % MOD;
p[nfact] = e;
}
++ d;
}
if(n > 1) {
++ nfact;
f[nfact] = n % MOD;
p[nfact] = 1;
}
}
LL invMod (LL x) {
return lgPow(x, MOD - 2);
}
int main() {
freopen("sumdiv.in", "r", stdin);
freopen("sumdiv.out", "w", stdout);
LL i, a, b, res, num;
scanf("%lld%lld", &a, &b);
if(b == 0) {
printf("1\n");
return 0;
}
fact(a);
for(i = 1; i <= nfact; ++ i)
p[i] *= (LL)b;
res = 1;
for(i = 1; i <= nfact; ++ i) {
num = lgPow(f[i], p[i] + 1) - 1;
if(num < 0)
num += MOD;
res = (res * num) % MOD;
res = (res * invMod(f[i] - 1)) % MOD;
}
printf("%lld\n", res);
return 0;
}