import math def primes(x): input_list=[False if i % 2==0 or i % 3 ==0 or i % 5 == 0 else True for i in range(x)] input_list[0] = input_list[1] = False input_list[2] = input_list[3] = input_list[5] = True sqrt = math.sqrt(x) for prime in range(3,x,2): if prime>=sqrt: break if not input_list[prime]: continue for s in range(prime ** 2,x,prime): input_list[s]=False return [i for i, b in enumerate(input_list) if b == True] n = int(input()) prime_list = primes(n+1) print(sum(prime_list))