import math n = int(input()) n_s = int(n**(1/2)) candidate = [i for i in range(2, n_s+1)] primes = [] limit = math.sqrt(n_s) + 1 while True: p = min(candidate) if limit <= p: primes.extend(candidate) break primes.append(p) candidate = [i for i in candidate if i % p != 0] s = 0 i = 63 for p in primes: while p**i > n: i -= 1 s += sum(list(p**j for j in range(2,i+1))) print(s)