N = int(input()) ans = 0 i = 2 while N > 1: while N%i==0: ans += i N //= i i += 1 print(ans)