import sys def input(): return sys.stdin.readline().rstrip('\n') def main(): n = int(input()) p = [False, False] + [True] * (n-1) for i in range(2, n+1): if p[i]: for j in range(2*i, n+1, i): p[j] = False print(sum(i for i in range(2, n+1) if p[i])) if __name__ == '__main__': main()