#include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; #define MOD 1000000007 int main() { int n; cin >> n; vector p(1001, true); for (int i = 2; i <= 1000; ++i) { if (p[i]) { for (int j = 2; i * j <= 1000; ++j) { p[i * j] = false; } } } ll ans = 0; for (int i = 2; i <= n; ++i) { if (p[i]) ans += i; } cout << ans << endl; return 0; }