implicit none
integer, parameter :: NMOD = 2019
integer(8) :: l,r
integer(8) :: i,j,maxj
integer(8) :: s,k

read *,l,r

if (r-l+1 >= NMOD) then
   write(*,'(a)') '0'
   stop
endif

s = mod(l*r,NMOD)
maxj = min(r, l+NMOD-1)
do i = l,maxj-1
   do j = i+1, maxj
      k = mod(i*j,NMOD)
      if (k == 0) then
         write(*,'(i0)') k
         stop
      else if (k < s) then
         s = k
      endif
   enddo
enddo

write(*,'(i0)') s
end