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