const LL Mod1 = 1000000000039LL, Mod2 = 1000000000038LL; LL mul1(LL a, LL b) { longdouble x = (longdouble) a * b; return (a * b - (LL) (x / Mod1) * Mod1 + Mod1); }
LL mul2(LL a, LL b) { longdouble x = (longdouble) a * b; return (a * b - (LL) (x / Mod2) * Mod2 + Mod2); }
LL qpow(LL a, LL k = Mod1 - 2) { LL res = 1; for (; k; k >>= 1, a = mul1(a, a)) if (k & 1) res = mul1(res, a); return res; }
voidsieve() { for (int i = 2; i < N; ++ i) { if (!st[i]) prime[++ cnt] = i; for (int j = 1; j <= cnt && i * prime[j] < N; ++ j) { st[i * prime[j]] = true; if (i % prime[j] == 0) break; } } }
inlineintgetid(LL x){ return x <= sq ? id1[x] : id2[n / x]; } inline LL sum1(LL x){ return x & 1 ? mul2(x, (x + 1) / 2) : mul2(x / 2, x + 1); } LL& adj(LL &x){ return x += x >> 63 & Mod2; }
voidsolveg1()// sigma(i) * i { for (int i = 1; i <= tot; ++ i) g[i] = sum1(a[i]) - 1; for (int i = 1; i <= tot; ++ i) h[i] = a[i] - 1; for (int i = 1; i <= cnt; ++ i) sp[i] = sp[i - 1] + prime[i]; for (int i = 1; i <= cnt; ++ i) sph[i] = i; for (int i = 1; i <= cnt; ++ i) { LL le = (LL) prime[i] * prime[i], tmp; for (int j = 1, id; j <= tot && a[j] >= le; ++ j) g[j] = (g[j] + (Mod2 - adj(tmp = g[id = getid(a[j] / prime[i])] - sp[i - 1])) * prime[i]) % Mod2, h[j] -= h[id] - sph[i - 1]; } // std::cout << g[1] << '\n'; }
voidsolveg2() { for (int i = 1; i <= tot; ++ i) h[i] = Mod2 - h[i], g[i] = h[i]; // std::cout << g[1] << '\n'; for (int i = cnt; i; -- i) { LL le = (LL) prime[i] * prime[i]; for (int j = 1; j <= tot && a[j] >= le; ++ j) { int nid = getid(a[j] / prime[i]); adj(adj(h[j] -= h[nid]) -= i); g[j] = (g[j] - h[nid] - i - g[nid] - i + 4 * Mod2) % Mod2; } } // std::cout << g[1] << '\n'; }
voidwork() { std::cin >> n; sq = std::sqrt(n) + 1, tot = 0; for (LL l = 1, r, t; l <= n; l = r + 1) { t = n / l, r = n / t; a[++ tot] = t; if (t <= sq) id1[t] = tot; else id2[r] = tot; } solveg1(); int lim = 1; LL res = 1; for (; a[lim + 1] >= sq; ++ lim) ; for (int i = 1; i <= cnt; ++ i) { if (prime[i] > a[lim]) break; LL cur = prime[i]; for (int k = 1; cur <= n; k ++, cur *= prime[i]) { LL mul = (mul2(cur, sum1(n / cur)) + mul2((Mod2 - cur) * prime[i] % Mod2, sum1(n / cur / prime[i]))) % Mod2; res = mul1(res, qpow(k + 1, mul)); } } LL mul = 0; for (LL l = 1, r, t; l <= n; l = r + 1) { t = n / l, r = n / t; if (getid(r) > lim) continue; mul = (mul + mul2(g[getid(r)] - g[std::min(lim, getid(l - 1))] + Mod2, sum1(t))) % Mod2; } res = mul1(res, qpow(2, mul));
solveg2(); res = mul1(res, qpow(2, g[1])); // std::cout << g[1] << '\n'; std::cout << res % Mod1 << '\n'; }