#include<iostream>
#include<cstdio>
#include<algorithm>
#include<math.h>
#include<cstring>
#include<string>
#include<vector>
using namespace std
;
typedef long long ll
;
const int mod
=1e9;
ll
qpow(ll a
,ll b
){
ll res
=1;
while(b
){
if(b
&1) res
=res
*a
%mod
;
a
=a
*a
%mod
;
b
>>=1;
}
return res
;
}
int main(){
ll a
,b
;
while(cin
>>a
>>b
){
ll ans
=qpow(a
,b
);
ans
=ans
%10;
cout
<<ans
<<endl
;
}
return 0;
}
转载请注明原文地址: https://lol.8miu.com/read-8720.html