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