#include #include #include using namespace std; typedef long long LL; const LL MOD = 129402307; LL modpow(LL M, LL N){ if(N <= 0) return 1; LL ans = modpow(M, N/2); ans = ans*ans%MOD; if(N%2 == 1) ans = ans*M%MOD; return ans; } int main(){ LL N = 0, M = 0; string ns, ms; cin >> ns >> ms; vector base(100001); vector base2(100001); base[0] = 1; base2[0] = 1; for(int i = 1; i < base.size(); i++){ base[i] = base[i-1] * 10 % MOD; base2[i] = base2[i-1] * 10 % (MOD-1); } for(int i = 0; i < ns.size(); i++){ N += (LL)(ns[i]-'0') * base[ns.size()-i-1] % MOD; N %= MOD; } for(int i = 0; i < ms.size(); i++){ M += (LL)(ms[i]-'0') * base2[ms.size()-i-1] % (MOD-1); M %= (MOD-1); } cerr << N << endl; cerr << M << endl; if(ns == "0"){// && ms != "0"){ cout << 0 << endl; }else{ cout << modpow(N, M) << endl; } return 0; }