N = int(input()) ans = 0 for i in range(2, N + 1): while N % i == 0: ans += i N //= i print(ans)