n = int(input()) ans = 0 for i in range(2, n+1): check = True for j in range(2, int(i**0.5) + 1): if i % j == 0: check = False break if check: ans += i print(ans)