let rec f x y = match x with
    | 0 -> y
    | _ -> f (x - 1) (y + x);;
    
let () = Scanf.scanf "%d" (fun x -> f x 0) |> Printf.printf "%d\n"