#include <stdio.h>
#include <iostream>
using namespace std;	
	int main ()
	{
		int i,j,prime[10000];
		for (i = 0; i < 10000; i++)
			prime[i] = 0;
		prime[0] = 2;
		
		for (j = 3; j; j++){
			for (i = 0; i < 10000; i++){
				if (prime[i] == 0){
					prime[i] = j;
					break;
				}
				if (j % prime[i] == 0)
					break;
			}
			if (prime[9999])
				break;
		}
		int table[10000]={0};
		table[prime[0]] = 1;
		table[prime[1]] = 1;
		table[prime[2]] = 1;

		int num;
		cin >> num;
		int x;
		int cnt=0;
		for(int i=0;i<10000;i++){
			if(prime[i]==1){
				x+=i;
				cnt++;
			}
			if(num == cnt){
				break;
			}
		}
		cout << x << endl;
	return 0;
	}