def isprime(p): if p <= 1: return False if p == 2: return True if p % 2 == 0: return False lim = int(p**0.5) + 1 for q in range(3, lim, 2): if p % q == 0: return False return True N = int(input()) ans = 2 if N >= 2 else 0 ans += sum(n for n in range(3, N + 1, 2) if isprime(n)) print(ans)