program ABC133C
    implicit none
    integer(8)::L,R,ans,i,j
    read*,L,R

    if(R/2019-(L-1)/2019>=1)then
        print'(i0)',0
    else
        ans=2019
        do i=L,R-1
            do j=i+1,R
                ans=min(ans,mod(i*j,2019))
            end do
        end do
        print'(i0)',ans
    end if
end program ABC133C