#include #include #include using namespace std; #define int long long #define rep(i,n) for(int i = 0; i < n; i++) #define INF (long long)(1e18) #define MOD (int)(1e9+7) #define min(a,b) (a>b?b:a) #define max(a,b) (a>b?a:b) #define yn(f) (f?"Yes":"No") #define YN(f) (f?"YES":"NO") #define pro "はいプロ 世界一○○が上手 ○○界のtourist ○○時代の終焉を告げる者 実質○○ ○○するために生まれてきた男" #define Answer_to_the_Ultimate_Question_of_Life_the_Universe_and_Everything 42 int mod = 6; long long power(long long x, long long n){ long long ans = 1; while(n){ if(n&1) ans *= x; n >>= 1; x *= x%mod; ans%=mod; } return ans; } signed main(){ int x[] = {2,8,5,7,1,4,0,0}; string n, k; int nsize, ksize, a; int N = 0, K = 0; cin>>n>>k; nsize = n.size(); ksize = k.size(); for(int i = 0; i < nsize; i++){ N*=10; N += (n[i]-'0')%6; N%=6; } for(int i = 0; i < ksize; i++){ K*=10; K += (k[i]-'0')%6; K%=6; } a = power(N,K); // cout<