main :: IO ()
main = getLine >>= print . solve . map read . words
solve :: [Int] -> Int
solve (l:r:_) 
  | r - l >= 2019 = 0
  | otherwise = minimum [ (i * j) `mod` 2019 | i <- [l..(r-1)], j <- [(i+1)..r] ]
