def isprime(n): for i in range(1, n + 1): 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)