N=int(input()) if N==1: exit(print(0)) A=list(range(2,N+1)) p=list() while A[0]**2<=N: tmp=A[0] p.append(tmp) A=[e for e in A if e%tmp!=0] l=p+A print(sum(l))