N = int(input()) A = [0] * (N+1) S = 0 for i in range(2,N+1): if A[i] == 0: S += i j = 2 while i + j <= N: A[i * j] = 1 j += 1 print(S)