Pagini recente » Cod sursa (job #1742078) | Cod sursa (job #1241392) | Monitorul de evaluare | Cod sursa (job #344513) | Cod sursa (job #2332738)
#include <iostream>
#include <fstream>
#include <climits>
#define mod 1999999973
using namespace std;
ifstream in("lgput.in");
ofstream out("lgput.out");
long long n,p,rez=1;
long long inm(long long x,long long y)
{
long long con=1,sol=1;
while(con<=y)
{
sol=(sol*x)%mod;
con++;
}
return sol;
}
int main()
{
in>>n>>p;
long long pt=inm(n,20000),cont=20000;
while(cont<=p)
{
rez=(rez*pt)%mod;
cont+=20000;
}
if(cont>p)cont=cont-20000+1;
while(cont<=p)
{
rez=(rez*n)%mod;
cont++;
}
out<<rez;
return 0;
}