program l2019
  integer(8) :: l,r,lm,rm
  integer :: i,j,m

  read(*,*) l,r
  m=2020
  if((l/673).ne.(r/673)) then
     m=0
  else
     lm=mod(l,2019)
     rm=mod(r,2019)
     do	i=lm,rm-1
	do j=lm+1,rm
           if(mod(i*j,2019).lt.m) then
	      m=mod(i*j,2019)
	   endif
        enddo
     enddo
  endif
  write(*,'(i0)') m


end program l2019


