n = int(input()) ans = 0 val = 2 while val * val <= n: if n % val == 0: ans += val n = n // val else: val += 1 if n >= 2: ans += n print("{}".format(ans))