Pagini recente » Cod sursa (job #2468011) | Cod sursa (job #579903) | Cod sursa (job #2342494) | Cod sursa (job #1083636) | Cod sursa (job #2664586)
/*
`-/oo+/- ``
.oyhhhhhhyo.`od
+hhhhyyoooos. h/
+hhyso++oosy- /s
.yoooossyyo:``-y`
..----.` ``.-/+:.`
`````..-::/.
`..```.-::///`
`-.....--::::/:
`.......--::////:
`...`....---:::://:
`......``..--:::::///:`
`---.......--:::::////+/`
----------::::::/::///++:
----:---:::::///////////:`
.----::::::////////////:-`
`----::::::::::/::::::::-
`.-----:::::::::::::::-
...----:::::::::/:-`
`.---::/+osss+:`
``.:://///-.
*/
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cmath>
#define debug(x) cerr << #x << " " << x << "\n"
#define debugsp(x) cerr << #x << " " << x << " "
using namespace std;
const int INF = 2e9;
const int MOD = 9901;
int FastPow(int b, int e) {
int r(1);
while(e) {
if(e & 1) r = (1LL * r * b) % MOD;
b = (1LL * b * b) % MOD;
e >>= 1;
}
return r;
}
void Euclid(int &x, int &y, int a, int b) {
if(b == 0) x = 1, y = 0;
else {
Euclid(x, y, b, a % b);
int aux = x;
x = y;
y = aux - y * (a / b);
}
}
int ModInv(int x) {
int inv, ins;
Euclid(inv, ins, x, MOD);
if(inv <= 0) inv = MOD + inv % MOD;
return inv % MOD;
}
int Compute(int d, int p) {
// (d ^ (p + 1) - 1) / (d - 1)
int a, b;
if(d % MOD != 1) {
a = (FastPow(d, p + 1) - 1 + MOD) % MOD;
b = ModInv(d - 1);
}
else {
a = 1;
b = p + 1;
}
return (a * b) % MOD;
}
int main() {
freopen("sumdiv.in", "r", stdin);
freopen("sumdiv.out", "w", stdout);
int a, b, d, ans;
scanf("%d%d", &a, &b);
d = 2;
ans = 1;
while(d * d <= a) {
if(a % d == 0) {
int p(0);
while(a % d == 0) {
++p;
a /= d;
}
ans = (1LL * ans * Compute(d, p * b)) % MOD;
}
if(!ans) debug(d);
d++;
}
if(a > 1) {
ans = (1LL * ans * Compute(a, b)) % MOD;
}
printf("%d\n", ans);
return 0;
}