#define _USE_MATH_DEFINES #include #include #include #include #include #include //#include #include #include #include #include #include #include ///////// #define REP(i, x, n) for(int i = x; i < n; i++) #define rep(i,n) REP(i,0,n) #define P(p) cout<<(p)< ///////// typedef long long LL; typedef long double LD; ///////// using namespace::std; ///////// const LL mod = 129402307; int main(void){ std::cin.tie(0); std::ios::sync_with_stdio(false); std::cout << std::fixed;// //cout << setprecision(16);// string N,M; cin>>N>>M; LL n,m; n = 0; rep(i,N.size() ){ n = (n*10 + N[i]-'0')%mod; } m=0; rep(i,M.size() ){ m = (m*10 + M[i]-'0')%(mod-1); } //n^m % mod /* n\m 0 0mod !0 0 - 0 0 0mod 1 0 0 num 1 1 val */ LL ans,mul; if( n == 0 && N.size() == 1){//N=0 if( 0 == m ){//0mod ans = 0; }else{ ans = 0; } }else if( n == 0 ){//N=0mod if( 0 == m && M.size() == 1){ ans = 1; }else if( 0 == m){ ans = 0;////////// }else{ ans = 0; } }else if( 0 == m && M.size() == 1){ ans = 1; }else if( 0 == m ){ ans = 1; }else{ ans = 1; mul = n; while( m ){ if( m%2 ){ ans = (ans * mul) % mod; } m /= 2; mul = (mul * mul) % mod; } } P(ans); return 0; }