typedef long long LL; LL pow(LL a, LL n, LL m){ LL res = 1; while(n){ if(n & 1){ res = res * a % m; } a = a * a % m; n >>= 1; } return res;