#include using namespace std; signed main() { ios::sync_with_stdio(false); int n; cin >> n; int s = 0; vector np(n + 1); for (int i = 2; i < n + 1; ++i) { if (np[i]) continue; s += i; for (int j = i + i; j < n + 1; j += i) np[j] = 1; } cout << s << endl; }