let rec f n = if n = 0 then 0 else n + f (n-1) let () = let n = Scanf.scanf "%d\n" (fun x -> x) in Printf.printf "%d\n" (f n)