#include using namespace std; #ifdef _RUTHEN #include "debug.hpp" #else #define show(...) true #endif using ll = long long; #define rep(i, n) for (int i = 0; i < (n); i++) template using V = vector; ll f(ll a, ll N, ll M) { rep(i, N) a = a * a % M; return a; } map prime_map(long long n) { map res; for (long long i = 2; i * i <= n; i++) { while (n % i == 0) { res[i]++; n /= i; } } if (n != 1) res[n]++; return res; } int main() { ios::sync_with_stdio(false); cin.tie(0); ll N; cin >> N; map mp; V CV; for (ll a = 20; a <= 5000; a++) { ll c = a * a - 398; if (c % 2 == 0) continue; CV.push_back(c); auto res = prime_map(c); for (auto [p, cnt] : res) mp[p]++; } ll M = 2; for (auto [p, cnt] : mp) { if (M >= 1000000000000000000LL / p) { show(p); break; } M *= p; } show(M); cout << M << '\n'; cout << f(2, N, M) << '\n'; return 0; }