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