#define _GLIBCXX_DEBUG #define ll long long #include using namespace std; using Graph = vector>; int main(){ vector Era(1001, true); Era[0] = Era[1] = false; for(int i = 2; i*i <= 1000; i++){ if(!Era[i]) continue; for(int j = i*2; j <= 1000; j += i){ Era[j] = false; } } int N; cin >> N; int ans = 0; for(int i = 1; i <= N; i++){ if(Era[i]) ans += i; } cout << ans << endl; }