""" """ import sys from sys import stdin N = int(stdin.readline()) ans = 0 for i in range(2,N+1): while N % i == 0: ans += i N //= i print (ans)