1 typedef long long ll; 2 #define MOD 1000000007 3 ll pow_mod(ll a, ll n) 4 { 5 if(n == 0) return 1; 6 ll x = pow_mod(a, n/2); 7 ll ans = x*x%MOD; 8 if(n%2==1) ans = ans*a%MOD; 9 return ans; 10 }
1 typedef long long ll; 2 #define MOD 1000000007 3 ll pow_mod(ll a, ll n) 4 { 5 if(n == 0) return 1; 6 ll x = pow_mod(a, n/2); 7 ll ans = x*x%MOD; 8 if(n%2==1) ans = ans*a%MOD; 9 return ans; 10 }