integer L,R
integer ans
read*,L,R
if(R-L>=2018)then
  print"(i0)",0
  stop
endif

L=mod(L,2019)
R=mod(R,2019)
if(R<L)then
  print"(i0)",0
  stop
endif

ans=2019
do i=L,R-1
  do j=L+1,R
    ans=min(ans,mod(i*j,2019))
  end do
end do

print"(i0)",ans

end