main = do
  li <-getLine
  let [l,r] = map read $ words li
  let ans = compute l r
  print ans

compute :: Int -> Int -> Int
compute l r = minimum
    [ (i*j) `mod` 2019
    | i <- [l..r1-1]
    , j <- [i+1..r1]
    ]
  where
    r1 = min (l + 2019) r