RT,
#include <bits/stdc++.h> using namespace std; int a,b; int main(){ cin>>a>>b; long long ans=pow(a,b); ans%=1000; printf("%03d",ans); return 0; }