#include <stdio.h>
#include <math.h>
int main()
{
int Num1,Num2;
while(scanf("%d %d",&Num1,&Num2)!=EOF)
{
printf("%d\n",getLastNum(Num1,Num2));
}
return ;
}
// 求a的b次幂最后一位数字为什么
int getLastNum(int a, int b)
{
int n = b%;
int x = a%;
int lastNum = ;
if(n == )
{
lastNum = pow(x,);
}
else
{
lastNum = pow(x,n);
}
lastNum = lastNum%;
return lastNum;
}