program main
  implicit none
  integer :: a, b, i
  read(*, *) a, b
  i = b - a
  write(*, "(i0)") height_ith(i) - b

  contains

  function height_ith(i)
    implicit none
    integer, intent(in) :: i
    integer :: height_ith
    height_ith = i * (i + 1) / 2
  end function height_ith
end program main
