#include #include void solve() { int n; std::cin >> n; std::vector isp(n + 1, true); isp[0] = isp[1] = false; for (int p = 2; p * p <= n; ++p) { if (!isp[p]) continue; for (int q = p * 2; q <= n; q += p) { isp[q] = false; } } int ans = 0; for (int x = 0; x <= n; ++x) { if (isp[x]) ans += x; } std::cout << ans << std::endl; } int main() { std::cin.tie(nullptr); std::ios::sync_with_stdio(false); solve(); return 0; }