n = int(input()) if n == 1: print(0) else: sum_of_prime = 0 for i in range(2, n + 1): counter = 0 for j in range(1, i): if i % j == 0: counter += 1 if counter == 1: sum_of_prime += i print(sum_of_prime)