/* -*- coding: utf-8 -*- * * 251.cc: No.251 大きな桁の復習問題(1) - yukicoder */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; /* constant */ typedef long long ll; const ll MOD = 129402307; /* typedef */ /* global variables */ /* subroutines */ ll str2n_mod(string &s, ll mod) { ll r = 0; int n = s.size(); for (int i = 0; i < n; i++) r = (r * 10 + (s[i] - '0')) % mod; return r; } ll powmod(ll a, ll b) { // a^b % MOD ll pm = 1; while (b > 0) { if (b & 1) pm = (pm * a) % MOD; a = (a * a) % MOD; b >>= 1; } return pm; } /* main */ int main() { string nstr, mstr; cin >> nstr >> mstr; ll n = str2n_mod(nstr, MOD); ll m = str2n_mod(mstr, MOD - 1); ll ans = powmod(n, m); printf("%lld\n", ans); return 0; }