program remainder_minimization_2019
    implicit none
    integer(8):: l,r,c,i,j
    integer(8),parameter:: max_loop=2019
    c=2019
    read*,l,r
    do i=l, min(r,l+max_loop)-1
        do j=i+1,min(r,l+max_loop)
            c = min(c,mod(i*j,2019))
        end do
    end do
    print*, c
        
end program remainder_minimization_2019