(* O(√n) *)
let n = read_int () in
let f m =
  if m = 0 then 0
  else
    let r = n mod m in
    let q = n / m in
    if r = q then m else 0 in
let rec sum acc i =
  if i * i > n then acc
  else if n mod i <> 0 then sum acc @@ i + 1
  else
    let j = n / i in
    sum (acc + f (i - 1) + if i <> j then f @@ j - 1 else 0) @@ i + 1 in
sum 0 1 |> Printf.printf "%d\n"