N = int(input()) ans = 2 for n in range(3,N+1,2): for d in range(3,int(n**.5)+1,2): if n%d == 0: break else: ans += n print(0 if N < 2 else ans)