N=int(input()) ans=0 for i in range(2,N+1): memo=0 for j in range(2,i): if i%j==0: memo+=1 break if memo==0: ans+=i print(ans)