#include #define rep(i,n)for(long long i=0;i<(n);i++) using namespace std; typedef unsigned long long ull; typedef long long ll; const ll INF=1e18; const int MOD=1e9+7; const double pi=acos(-1); bool is_prime(long long n) { if (n <= 1) return false; for (long long p = 2; p * p <= n; ++p) { if (n % p == 0) return false; } return true; } int main(){ int n; cin >> n; ll ans=0; rep(i,n){ if(is_prime(i+1))ans+=i+1; } cout << ans << endl; }