#include #define rep(i, a) for (int i = 0; i < (a); i++) #define rep2(i, a, b) for (int i = (a); i < (b); i++) #define repr(i, a) for (int i = (a) - 1; i >= 0; i--) #define repr2(i, a, b) for (int i = (b) - 1; i >= (a); i--) using namespace std; typedef long long ll; struct C { int ub; vector fact; ll mod; C(ll mod) : ub(0), mod(mod) {} C(int n, ll mod) : ub(ub), mod(mod) {} void build() { fact.resize(ub); fact[0] = 1; rep2 (i, 1, fact.size()) fact[i] = i * fact[i - 1] % mod; } ll modF(ll a) { if (a < fact.size()) { return fact[a]; } else { ll res = 1; rep (i, a) { res *= i + 1; res %= mod; } return res; } } ll modP(ll a, ll b) { return fact[a] * modinv(modF(a - b), mod) % mod; } ll modC(ll a, ll b) { return modP(a, b) * modinv(modF(b), mod) % mod; } static ll modpow(ll a, ll b, ll mod) { if (b == 0) return 1; return modpow(a * a % mod, b / 2, mod) * (b & 1 ? a : 1) % mod; } static ll modpow(string a, string b, ll mod) { if (b == "0") return 1; if (a == "0") return 0; ll x = modulo(a, mod); ll y = modulo(b, mod - 1); if (x == 0) return 0; if (y == 0) return 1; return modpow(x, y, mod); } static ll modinv(ll a, ll mod) { return modpow(a, mod - 2, mod); } static ll modulo(ll a, ll mod) { a %= mod; a += mod; a %= mod; return a; } static ll modulo(string s, ll mod) { ll res = 0; rep (i, s.length()) { res = res * 10 + (s[i] - '0'); res %= mod; } return res; } }; int main() { string N, M; cin >> N >> M; cout << C::modpow(N, M, 129402307) << endl; return 0; }