#include<bits/stdc++.h> using namespace std; int main(){ int a,b,c; cin>>a>>b; for(int o=1;o<=b;o++){ a*=a; } c=b%=1000; if(c<100&&c>10) cout<<0<<c; if(c<10) cout<<0<<0<<c; else cout<<c; return 0; }