import sys N = int(input()) if N == 1: print(0) exit() i = 2 prime = [] while i ** 2 <= N: if N % i == 0: prime.append(i) N = N // i else:i += 1 prime.append(N) print(sum(prime))