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

main = do
    x <- getLine
    let [l, r] = (map$toInt)$words x
    let i = if (r - l) >= (l - 2019)
        then
            2019
        else
            l
    let j = if (i - l) >= 2019
        then
            2019 * (l `div` 2019)
        else
            i + 1
    print ((i * j) `mod` 2019)