program main
implicit none
integer(8) :: l, r, i, j, res

read(*,*) l, r
if( r - l .ge. 2019 ) then 
   write(*,'(i0)') 0
   stop
else
   res = 2018
   do i = l, r-1
      do j = i+1, r
         if( mod( mod(i,2019)*mod(j,2019), 2019 ) .le. res ) then
            res = mod( mod(i,2019)*mod(j,2019), 2019 )
         end if
      end do
   end do
   write(*,'(i0)') res
end if
end program main
