快速幂
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll ans = 1;
ll Fastsub(ll base, ll pow) {
while (pow != 0) {
if (pow % 2 == 1) { //幂为奇数的话先乘一个一次方
ans = ans * base % (1000);
}
pow /= 2; //幂不论偶数奇数都减半,底数再平方
base = base * base % (1000);
}
return ans;
}
int main() {
ll a, b;
cin >> a >> b;
Fastsub(a, b);
cout << ans;
return 0;
}