program main
 implicit none
 integer*16 L,R,i,j,m,v,ans
 data m /2019/
 read(*,*) L,R
 L = mod(L,m)
 R = mod(R,m)
 if(L >= R) then
  R = R + m
 end if
 ans = 4000
 do i=L,R-1
  do j=i+1,R
   v = mod(i*j,m)
   if(ans >= v) then
   !write(*,*) i,j,v
    ans = v
   end if
  end do
 end do
 write(*,*) ans
end program main

