#include #include #include #include #include #include #define REP(i,n) for(int i=0;i=0;i--) #define FOR(i,m,n) for(int i=m;i inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; } template inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } //const ll INF = 1LL << 60; //const int INF = 1001001001; vector sieve_of_eratosthenes(int n) { vector primes(n); for (int i = 2; i < n; ++i) primes[i] = i; for (int i = 2; i*i < n; ++i) if (primes[i]) for (int j = i*i; j < n; j+=i) primes[j] = 0; return primes; } int main(void){ int n; cin >> n; vector v=sieve_of_eratosthenes(n+1); cout << accumulate(ALL(v),0) << endl; return 0; }