program name
    use,intrinsic :: iso_fortran_env
    implicit none
    integer(int32):: l,r,i,j,md

    read*, l,r
    if (r-l+1 >= 3000) then
        print'(i0)', 0
        stop
    end if
    md=50000000
    do i=l,r-1
        do j=i+1,r
            md=min(md,mod(i*j,2019))
        end do
    end do
    print'(i0)', md
end program name