program main
  implicit none
  integer(8) i,L,R,dist,ans,j
  ans = 2020
  read(*, *) L, R
  dist = min(2019,R-L)
  do i = L,L+dist-1
    do j = i+1,L+dist
      ans = min(ans,mod(i*j,2019))
    end do
  end do

  write(*,*) ans
end program main
