#include <iostream> using namespace std; const int maxn =10000000; int n,size ; int prime[maxn+5]; bool vis[maxn+5]; int main() { cin >>n; size = 0; for (int i= 2; i<=n; ++i) { if (!vis[i]) { size = size + 1; prime[size]= i; } for (int j=1; i*prime[j]<=n; ++j) { vis[i * prime[j]]= 1; if (i % prime[j]==0) break ; } } int sum = 0; for (int i=1; i<=size; ++i) sum=sum + prime[i]; cout<<sum<<endl; return 0; }