#include <iostream>
using namespace std;
bool prim(int n)
{
if (n <= 1)
{
return false;
}
else
{
for (int i = 2; i <= n / 2; i++)
{
if (n % i == 0)
{
return false;
break;
}
}
}
return true;
}
int main()
{
int n, s = 0;
cin >> n;
int numara = 0;
for (int i = 1; numara < n; i++)
{
if (prim(i) == true)
{
s += i;
numara++;
}
}
cout << s;
return 0;
}