Pagini recente » Rating Pas Andrei-Nicu (andreipasnicu) | Cod sursa (job #1696315) | Cod sursa (job #2725947) | Cod sursa (job #990526) | Cod sursa (job #756465)
Cod sursa(job #756465)
#include <cstdio>
#include <vector>
#define Mod 9901LL
#define LL long long
using namespace std;
LL A, B, S;
inline LL Pow (LL X, LL P)
{
LL R=1; X%=Mod;
while (P)
{
if (P%2==0) X=(X*X)%Mod, P/=2;
else R=(R*X)%Mod, --P;
}
return R;
}
inline LL MI (LL X)
{
return Pow (X, Mod-2);
}
inline LL ComputeF (LL X, LL P)
{
if (X%Mod==1) return P+1;
return ((Pow (X, P+1)+Mod-1)*MI (X-1))%Mod;
}
void Solve ()
{
S=1LL;
if (A%Mod==0 or B==0 or A==1) return;
for (LL i=2; i*i<=A and A>1; ++i)
{
LL e=0;
for (; A%i==0; A/=i, ++e);
if (e)
{
e*=B;
S=(S*ComputeF (i, e))%Mod;
}
}
if (A>1) S=(S*ComputeF (A, B))%Mod;
}
void Read ()
{
freopen ("sumdiv.in", "r", stdin);
scanf ("%lld %lld", &A, &B);
}
void Print ()
{
freopen ("sumdiv.out", "w", stdout);
printf ("%lld\n", S);
}
int main ()
{
Read ();
Solve ();
Print ();
return 0;
}