#include using namespace std; int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); int n; cin >> n; vector F(n + 1, true); F[0] = F[1] = false; for(int i = 2; i <= (int)(sqrt(n)); i++){ if(F[i]) for(int j = i + i; j <= n; j += i){ F[j] = false; } } int ans = 0; for(int i = 2; i <= n; i++){ if(F[i]) ans += i; } cout << ans << endl; return 0; }