n = int(input()) i = 2 cnt = 0 while i <= n: if n%i == 0: cnt += i n = n//i continue i += 1 print(cnt)