program min
  implicit none
  integer(8) :: l, r, lmod, ans, rmod, i, j
  integer(8),parameter :: a = 2019
  
  read *, l, r 
  lmod = mod(l,a)
  rmod = mod(r,a)
  if (r >= (l/a+1)*a) then
    ans = 0
  else 
    do i = l, r 
      do j = i+1, r
        if (mod(i*j,a) < ans) ans = mod(i*j,a)
      end do
    end do
  end if
  print '(i0)', ans
  stop
end program min
