from sys import stdin, stdout input = lambda: stdin.readline().rstrip() write = stdout.write def main(): N = int(input()) lst = erastosthenes(N) prime_list = [2] + [i for i in range(3, N + 1, 2) if lst[i]] print(sum(prime_list)) def erastosthenes(n): prime = [0, 1] * ((n + 1) // 2) if not n % 2: prime += [0] prime[1], prime[2] = 0, 1 sqrt = n ** 0.5 i = 3 while i <= sqrt: for j in range(i ** 2, n + 1, i): prime[j] = 0 i += 2 return prime main()