#include <iostream> #include <cstdio> #include <algorithm> using namespace std; int main(){ int a,b; while(scanf("%d%d",&a,&b)!=EOF){ if(!a&&!b) break; int ans=1; for(int i=1;i<=b;i++) ans=(ans*a)%1000; printf("%d ",ans); } return 0; }
#include <iostream> #include <cstdio> #include <algorithm> using namespace std; int main(){ int a,b; while(scanf("%d%d",&a,&b)!=EOF){ if(!a&&!b) break; int ans=1; for(int i=1;i<=b;i++) ans=(ans*a)%1000; printf("%d ",ans); } return 0; }