toInt :: (String -> Int)
toInt x = read x ::Int

main = do
    x <- getLine
    let [l, r] = (map$toInt)$words x

    let
        distl = l `mod` 2019
        distr = r `mod` 2019

    print $ if (r `div` 2019) - (l `div` 2019) >= 1
        then
            0
        else
            minimum [x * y `mod` 2019 | x <- [distl..distr - 1], y <- [distl + 1..distr]]
