from sympy import isprime N = int(input()) ans = 0 for i in range(N + 1): if isprime(i): ans += i print(ans)