#include <iostream>
#include <fstream>
#include <math.h>
//#include <windows.h>
using namespace std;
ifstream f ("lgput.in");
ofstream g ("lgput.out");
long long int k=1999999973;
long long int exp(long long int x,long long int y)
{
if(y==0)
{
return 1;
}
if(y%2)
{
return x*(exp(x*x,(y-1)/2));
}
return exp(x*x,y/2);
}
int main()
{
long long int n,rez,p,x=0;
f>>n>>p;
x=exp(n,p);
//cout<<"Mie imi da: "<<x<<endl;
g<<(long long)x%k;
/* rez=1;
while(p)
{
if(p%2)
{
rez=((long long)rez*n);
}
n=((long long)n*n);
p=p/2;
}
cout<<"Varianta corecta da:"<<rez;
*/ return 0;
}