n = gets.to_i

cnt = 0
i = 2
while i * i <= n do
	while n % i == 0 do
		cnt += i
		n /= i
	end
	i += 1
end
cnt += n if n != 1

puts cnt