#include using namespace std; #ifdef LOCAL #include "settings/debug.cpp" #define _GLIBCXX_DEBUG #else #define Debug(...) void(0) #endif using ll = long long; #define rep(i, n) for (int i = 0; i < (n); ++i) int main() { constexpr auto is_prime = [] { array res {}; res[0] = res[1] = false; for (int i = 2; i <= 1000; ++i) { res[i] = true; for (int j = 2; j * j <= i; ++j) { if (i % j == 0) { res[i] = false; } } } return res; }(); int n; cin >> n; int ans = 0; rep(i, n + 1) if (is_prime[i]) ans += i; cout << ans << endl; return 0; }