object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val sums = 2.to(999).scanLeft(1 -> 1) {
    case ((_, acc), r) => r -> (acc + r)
  }.toMap
  val a, b = sc.nextInt()
  println(sums.getOrElse(b - a, 0) - b)
}
