program remainder_minimization_2019
  implicit none
  integer :: l, r, m, i, j
  m = 2020
  read(*,*) l, r
  if (r-l.ge.2018) then
    l = 0
    r = 2018
  end if
  l = mod(l,2019)
  r = mod(r,2019)
  if (l.gt.r) r = r+2019
  do i = l, r-1
    do j = i+1, r
      m = min(m,mod(i*j,2019))
    end do
  end do
  write(*,'(i0)') m
  stop
end program remainder_minimization_2019