#include #define rep(i, n) for(int i=0, i##_len=(n); i=0; --i) #define rreps(i, n) for(int i=((int)(n)); i>0; --i) #define all(v) (v).begin(), (v).end() #define el '\n' using namespace std; using ll = long long; using ull = unsigned long long; using vi = vector; using vvi = vector>; using vvvi = vector>>; using vl = vector; using vvl = vector>; using vvvl = vector>>; using vs = vector; using pi = pair; using pl = pair; template using min_priority_queue = priority_queue, greater>; template bool chmax(T &a, const T &b) { if (a bool chmin(T &a, const T &b) { if (b bool chmaxeq(T &a, const T &b) { if (a<=b) { a=b; return 1; } return 0; } template bool chmineq(T &a, const T &b) { if (b<=a) { a=b; return 1; } return 0; } bool yes(bool a=true) { cout << (a?"yes":"no") << el; return a; } bool no(bool a=true) { cout << (a?"no":"yes") << el; return a; } bool Yes(bool a=true) { cout << (a?"Yes":"No") << el; return a; } bool No(bool a=true) { cout << (a?"No":"Yes") << el; return a; } bool YES(bool a=true) { cout << (a?"YES":"NO") << el; return a; } bool NO(bool a=true) { cout << (a?"NO":"YES") << el; return a; } template istream &operator>>(istream &is, pair &p); template ostream &operator<<(ostream &os, const pair &p); template istream &operator>>(istream &is, vector &v); template ostream &operator<<(ostream &os, const vector &v); template istream &operator>>(istream &is, pair &p) { return is >> p.first >> p.second; } template ostream &operator<<(ostream &os, const pair &p) { return os << p.first << ' ' << p.second; } template istream &operator>>(istream &is, vector &v) { int sz = v.size(); for (int i = 0; i < sz; i++) is >> v[i]; return is; } template ostream &operator<<(ostream &os, const vector &v) { int sz = v.size(); for (int i = 0; i < sz; i++) { if (i) os << ' '; os << v[i]; } return os; } void _main(); int main() { cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(16); _main(); return 0; } template concept gnu_integral = requires { requires (integral || same_as<__int128_t, T> || same_as<__uint128_t, T>); }; template concept gnu_signed_integral = requires { requires (signed_integral || same_as<__int128_t, T>); }; template concept gnu_unsigned_integral = requires { requires (unsigned_integral || same_as<__uint128_t, T>); }; /** * @brief 冪乗の剰余を求める。 * * O(log y) * @tparam _int `mod` の型 * @tparam _long `_int` の倍の精度の整数型 * @param x 底 * @param y 指数 * @param mod 法 * @return 冪乗の剰余 */ template constexpr _int pow_mod(_long x, _long y, _int mod) { if (y == 0) return 1 % mod; _long res = pow_mod<_int, _long>(x, y/2, mod); res = res*res%mod; if (y % 2 == 1) res = res*x%mod; return res; } void _main() { vi v(100100, -1); int A = 23040; int B = 6144; int Y = pow_mod(A, B, 1000000007); bool ok = true; for (int X = 100; X <= 100000; X++) { int K = gcd(X, Y); int Xd = pow_mod(X, A, B); v[K] = Xd; } cout << A << ' ' << B << endl; int K; cin >> K; cout << v[K] << endl; int res; cin >> res; assert(res == 1); }