let () = Scanf.scanf "%d %d" @@ fun a b ->
  (* 
    n * (n + 1) / 2 - h = a
    (n + 1) * (n + 2) / 2 - h = b

    b - a = (n + 2) * (n + 1) / 2 - n * (n + 1) / 2 
    b - a = n + 1
    n = b - a + 1
    h = n * (n + 1) / 2 - a
  *)
  let n = b - a in
  Printf.printf "%d\n" @@ n * (n + 1) / 2 - b
