n=int(input()) if n==1:print(0) else: p=[2] for i in range(3,n+1,2): for j in p: if i%j==0: break else: p.append(i) print(sum(p))