import math import sys def S(): return sys.stdin.readline().rstrip() def I(): return int(sys.stdin.readline().rstrip()) def MI(): return map(int, sys.stdin.readline().rstrip().split()) def LI(): return list(map(int, sys.stdin.readline().rstrip().split())) def LS(): return list(sys.stdin.readline().rstrip().split()) n = I() p = [2] for i in range(3, n+1): for j in range(2, int(i**0.5)+2): if i%j == 0: break else: p.append(i) if n == 1: print(0) else: print(sum(p))