#include <iostream> #include <iomanip> using namespace std; int main() { int a, b; cin >> a >> b; int s = 1; while (b--) { s *= a; s %= 1000; } cout << setw(3) << setfill('0') << s; return 0; }