      PROGRAM RemainderMinimization2019
      IMPLICIT NONE
      integer(16) :: l,r, i,j
      integer(16) :: ans=2*10**8+1,buffer
      
      read*,l,r
      
      do i = l,r-1
        do j = i+1,r
          buffer = mod(i*j,2019)
          ans = min( ans,buffer )
          if( ans==0 )then
            print*,ans;stop
          end if
        end do
      end do
      
      print*,ans
      
      
      
      
      
      END PROGRAM