program main
  implicit none
  integer(8) :: l, r, i, j, res
  read (*, *) l, r
  if (r - l >= 2018) then
    write (*, "(i0)") 0
  else
    res = 2019
    do i = l, r - 1
      do j = i + 1, r
        res = min(res, mod(i * j, 2019_8))
      end do
    end do
    write (*, "(i0)") res
  end if
end program main
