#include using namespace std; typedef long long ll; typedef long double ld; typedef pair l_l; typedef pair i_i; typedef vector vel; typedef vector vei; typedef vector vec; typedef vector veb; typedef vector ves; typedef vector> ve_vel; typedef vector> ve_vei; typedef vector> ve_vec; typedef vector> ve_veb; typedef vector> ve_ves; #define rep(i,n) for(int i=0;i<(int)(n);i++) #define rep1(i,n) for(int i=1;i<(int)(n);i++) #define rep2(i,n) for(int i=2;i<(int)(n);i++) #define repk(i,k,n) for(int i=k;i<(int)(n);i++) #define fs first #define sc second #define pub push_back #define puf push_front #define pob pop_back #define all(a) a.begin(),a.end() #define rall(a) a.rbegin(),a.rend() #define maxel(a) *max_element(all(a)) #define minel(a) *min_element(all(a)) #define acc accumulate #define EPS (1e-7) #define INF (1e9) #define PI (acos(-1)) #define mod (1000000007) template bool chmax(T &a, const T &b) { if (a bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; } template void remove(T & vector, unsigned int index){vector.erase(vector.begin() + index);} #define MAX_N 10005 int prime[MAX_N]; //i番目の素数 bool is_prime[MAX_N+1]; //is_prime[i]==true->iはprime //n以下の素数の数を返す void sieve(int n) { int p = 0; rep(i,n+1) is_prime[i] = true; is_prime[0] = is_prime[1] = false; rep2(i,n+1) { if(is_prime[i]) { prime[p++] = i; for(int j = 2 * i; j<= n; j+= i) is_prime[j] = false; } } return ; } int main(){ cin.tie(0); ios::sync_with_stdio(false); int N; cin >> N; sieve(N); ll ans = 0; for(int i = 1; i <= N; i++) { if(is_prime[i]) ans += i; } cout << ans << endl; return 0; }