def isp(x): if x <= 1: return False if x == 2: return True for i in range(2, int(x ** 0.5) + 2): if x % i == 0: return False return True N = int(input()) ans = 0 for i in range(2, N + 1): if isp(i): ans += i print(ans)