program abc133c
  use,intrinsic :: iso_fortran_env
  implicit none
  integer(int64) :: l, r, i, j, ans
  read *, l, r
  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 program abc133c
