#!/usr/bin/python2 # -*- coding: utf-8 -*- # † def sum_of_primes(n): r = int(n ** .5) V = [n//i for i in xrange(1, r+1)] V += reversed(xrange(V[-1])) S = {i: i*(i+1)//2-1 for i in V} for p in xrange(2, r+1): if S[p] > S[p-1]: p2 = p * p for v in V: if v < p2: break S[v] -= p * (S[v//p] - S[p-1]) return S[n] n = int(raw_input()) print sum_of_primes(n)