IsPrime = [True for _ in range(1001)] IsPrime[0] = IsPrime[1] = False for i in range(2, 1001): if IsPrime[i]: for j in range(i + i, 1001, i): IsPrime[j] = False n = int(input()) ans = 0 for i in range(n + 1): if IsPrime[i]: ans += i print(ans)