#include <bits/stdc++.h>
using namespace std;
#define LL long long
int fastPower(LL base, LL power){
int res = 1;
while(power){
if(power&1) res = res*base%10;
base = base*base%10;
power >>= 1;
}
return res;
}
int main(){
int a, b;
while(scanf("%d %d", &a, &b) == 2){
printf("%d\n", fastPower(a, b));
}
return 0;
}
05-05
717
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
01-18
1808
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)