#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define nl '\n'
#define mod 1000000007
#define fori(i,n) for(ll i=0;i < n;i++)
#define forn(i,n) for(ll i=1;i <= n;i++)
#define forx(i,x,n) for(ll i=x;i < n;i++)
#define sortx(x) sort(x.begin(),x.end())
#define sorty(x) sort(x.begin(),x.end(),greater<>())
using namespace std;
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
using namespace __gnu_pbds;
#define ordered_multiset tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update>
ll Mod(ll base, ll exp, ll MOD){
if(exp == 0) return 1;
ll res = Mod(base,exp/2,MOD);
if(exp % 2)
return (((res * res) % MOD)*base) % MOD;
else
return (res*res) % MOD;
}
ll gcd(ll x,ll y){
ll b = min(x,y);
ll a = max(x,y);
while(b != 0){
ll temp = b;
b = a % b;
a = temp;
}
return a;
}
ll div(vector<ll> &x){
for(ll i=1;i <= 1000007;i++){
for(ll j=i;j <= 1000007;j+=i){
x[j]++;
}
}
}
bool prime(ll n){
int c=0;
for(ll i=1;i <= n;i++){
if(n % i == 0) c++;
if(c > 2) break;
}
if(c == 2) return true;
return false;
}*/
void generatePrimes(int limit, vector<bool> &isPrime) {
isPrime.assign(limit + 1, true);
isPrime[0] = isPrime[1] = false;
for (int i = 2; i * i <= limit; i++) {
if (isPrime[i]) {
for (int j = i * i; j <= limit; j += i) {
isPrime[j] = false;
}
}
}
}
ll computePrimeSums(ll n, ll &sum, const vector<bool> &isPrime) {
for (int i = 2; i <= n; i++) {
sum += (isPrime[i] ? i : 0);
}
return sum;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
const int LIMIT = 100000;
vector<bool> isPrime(LIMIT + 1, true);
ll sum=0;
generatePrimes(LIMIT, isPrime);
ll n;
cin >> n;
computePrimeSums(n, sum, isPrime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