import math def get_prime(n): if n <= 1: return [] prime = [2] limit = int(math.sqrt(n)) data = [i for i in range(3,n,2)] while limit > data[0]: prime.append(data[0]) data = [i for i in data if i%data[0] != 0] return prime + data n = int(input()) print(sum(get_prime(n)))