#include #include #include #include #include using namespace std; int main() { int n, sum1 = 0; cin >> n; vector v(n+1, 1); for (int i = 2; i <= n; i++){ if (v[i]){ for (int j = i*i; j <= n; j += i){ v[j] = 0; } } } for (int i = 2; i <= n; i++){ if(v[i]) sum1 += i; } cout << sum1 << endl; }