program test

integer(8) :: i,j,k,l,r,ll,rr,ans=10**9,new,sa

read(*,*) l,r

ll = mod(l,2019)
rr = mod(r,2019)

sa = r - l 

if(ll == 0 .or. rr == 0 .or. ll >= rr .or. sa >= 2019)then
  ans = 0
else
  do i=ll,rr-1
    do j=i+1,rr
      new = mod(i*j,2019)
      ans = min(new,ans)
    enddo
  enddo
endif

write(*,*) ans

end program