voidsolve() { // puts("One Division"); // for (int i = 1; i <= tot; ++ i) printf("%d cnt = %d\n", p[i], cnt[i]); int k = 0, ans; for (int i = 1; i <= tot; ++ i) k += p[i] / 2 * cnt[i] + p[i] * cnt[i] * (cnt[i] - 1) / 2; for (int i = 1; i <= tot; ++ i) for (int j = i + 1; j <= tot; ++ j) k += g[p[i]][p[j]] * cnt[i] * cnt[j]; ans = qpow(2, k); for (int i = 1; i <= tot; ++ i) ans = (LL) ans * qpow(p[i], Mod - 1 - cnt[i]) % Mod * infact[cnt[i]] % Mod; // std::cout << ans << '\n'; adj(res += ans - Mod); }
voiddfs(int ls, int rem) { if (rem == 0) returnsolve(); ++ tot; for (int i = ls + 1; i <= rem; ++ i) for (p[tot] = i, cnt[tot] = 1; cnt[tot] * i <= rem; ++ cnt[tot]) dfs(i, rem - i * cnt[tot]); -- tot; }
intmain() { init(); std::cin >> n; for (int i = 0; i <= n; ++ i) for (int j = 0; j <= n; ++ j) g[i][j] = Gcd(i, j); dfs(0, n); std::cout << res << '\n'; return0; }