#include<bits/stdc++.h> #define LL long long constint P = 1e9 + 7; constint BL = (1 << 16) + 5, B = sqrt(P); int qp[BL][2]; int ph; intphi(int x) { int res = x; for (int i = 2; i * i <= x; i++) { if (x % i == 0) res = res / i * (i - 1); while (x % i == 0) x /= i; } if (x > 1) res = res / x * (x - 1); return res; } voidinit(int x) { ph = phi(P); qp[0][0] = qp[0][1] = 1; for (int i = 1; i <= B; ++i) qp[i][0] = qp[i - 1][0] * x % P; for (int i = 1; i <= B; ++i) qp[i][1] = qp[i - 1][1] * qp[B][0] % P; } intqqpow(int y) { y %= ph; return qp[y % B][0] * qp[y / B][1] % P; }