LL modpow(LL a, LL b) { LL r = 1; while (b) { if (b % 2 == 1) r = r * a % kMod; a = a * a % kMod; b /= 2; } return r; }