def p(n): i=2 while i*i<=n: if n%i==0: return False i+=1 return True print(sum([i if p(i) else 0 for i in range(2,int(input())+1)]))