program main
integer(16) :: l,r,i,j,m,mo

m=2019
read(*,*)l,r

!l = mod(l,2019)
!r = mod(r,2019)
do i = l,r-1
do j = i+1,r
i = mod(i,2019)
j = mod(j,2019)
mo = mod(i*j,2019)
if (m > mo) m = mo
end do
end do

write(*,*)m

end program main