n = int(input()) l = [i+1 for i in range(n)] ans = [] for i in l: if i == 1: pass elif i == 2: ans.append(i) elif i%2 == 0: pass else: for j in range(2, i+1): if i%j == 0: break if j == i-1: ans.append(i) print(sum(ans))