def isprime(n): for i in range(2, n): if n % i == 0: return False if i * i > n: return True return True n = int(input()) ans = 0 for i in range(2, n + 1): if isprime(i): ans += i print(ans)