#include #include using namespace std; struct SieveEratos{ vector t; SieveEratos(int n):t(n+1,true){ t[0] = t[1] = false; for(int i = 2; n >= i; i++){ if(t[i]){ for(int j = i+i; n >= j; j+=i){ t[j] = false; } } } } bool operator[](int x){return t[x];} }; int main(){ int n;cin>>n; SieveEratos a(1001); int sm = 0; for(int i = 0; n >= i; i++){ if(a[i])sm+=i; } cout << sm << endl; }