i=int(input()) sum=0 if(i==2): sum+=2 elif(i>2): sum+=2 for j in range(3,i+1,2): if(j==3): sum+=3 else: for k in range(3,int(j/2),2): if(j%k==0): break else: sum+=j print(sum)