#include #include #include #include #include #include #include #include #include #include #include #define repd(i,a,b) for (int i=(a);i<(b);i++) #define rep(i,n) repd(i,0,n) typedef long long ll; using namespace std; int inputValue(){ int a; cin >> a; return a; }; template void output(T a, int precision) { if(precision > 0){ cout << setprecision(precision) << a << "\n"; } else{ cout << a << "\n"; } } const ll MOD = 129402307; ll strMod(string s, ll mod){ ll ret = 0; rep(i, s.size()) { ret += s[i] - '0'; if (ret > mod) { ret %= mod; } if (i != s.size() - 1) { ret *= 10; } } return ret; } // a ^ b % mod ll powMod(ll a, ll b, ll mod){ ll ret = 1; while (b > 0) { if (b & 1) { ret = ret * a % mod; } a = a * a % mod; b >>= 1; } return ret; } int main() { // source code string N, M; cin >> N >> M; if(M == "0"){ output(1, 0); return 0; } ll n = strMod(N, MOD); ll m = strMod(M, MOD - 1); output(powMod(n, m, MOD), 0); return 0; }