#include<iostream>
#include<math.h>
using namespace std;

int n;
int tf[400];
int prime[400];

void P(int n){
	int t = sqrt(n), k = 0;
	for (int i = 2; i <= t; i++){
		if (tf[i] == 0){
			prime[k++] = i;
			for (int j = 2; j*i <= t; j++){
				tf[j*i] = 1;
			}
		}
	}
}

int main(){
	P(15000);
	int n;
	long long sum=0;
	while (cin >> n){
		for (int i = 0; i < n; i++){
			sum += prime[i];
		}
		cout << sum;
	}
}