program kadai
implicit none
integer(8)  ::  l,r
integer  ::  i,j,k
integer,allocatable  ::  ans(:)
integer  ::  mn


read(*,*) l,r

if (r/2019-l/2019>0) then
    write(*,*) 0
    stop
end if

l=mod(l,2019)
r=mod(r,2019)

allocate(ans(r-l))
ans=2020
k=1
do i=l,r
    do j=i+1,r
        ans(k)=mod(i*j,2019)
        k=k+1
    end do
end do

mn=minval(ans)
!write(*,*) ans
write(*,*) mn!,l,r

stop

end program kadai