program abc133c
  use,intrinsic :: iso_fortran_env
  implicit none
  integer(int64) :: l, r, i, j, ans
  read *, l, r
  if (l - r + 1 >= 2019) then
     print *, 0
  else
     ans = 2019
     do j = l+1,r
        do i = l,j
           ans = min(ans,mod(i*j,2019))
           if (ans == 0) exit
        end do
     end do
     print *, ans
  end if
end program abc133c
