require "prime"

n = gets.to_i
pnum_arr = Prime.prime_division(n).map{|pnum, exp_num| [pnum] * exp_num }.flatten

arr = [1, 1]
pnum_arr.each_with_index do |pnum, i|
  arr[i % 2] *= pnum
end

puts arr.sum - 2
