local n = io.read("*n") local r = 0 for i = 2, 300000 do while n % i == 0 do r = r + i n = math.floor(n / i) end end print(r)