program main
 implicit none
 integer*8 L,R,i,j,v,mini,m
 data m /2019/
 read(*,*) L,R
 L = mod(L,m)
 R = mod(R,m)
 if(L >= R) then
  write(*,*) 0
 else
  mini = 2018
  do i=L,R-1
   do j=i+1,R
    v = mod(i,m)*mod(j,m)
    v = mod(v,m)
    if(v < mini) then
     mini = v
    end if
   end do
  end do
  write(*,*) mini
 end if
end program main