program ccc

implicit none
integer(8) :: l, r, i, j, ans

read*, l, r

do i=1,10000000
if(l>=2019) then
l=l-2019
r=r-2019
else
exit
end if
end do

if(r>=2019) then
write(*,'(i0)') 0
return
end if

ans=1000000

do i=l, r
 do j=i+1, r
 ans=min(ans,mod(i*j,2019))
 end do
end do

write(*,'(i0)') ans

end program