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

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

    let distl = minimum [(l `mod` 2019), abs (2019 - (l `mod` 2019))]
    let distr = minimum [(r `mod` 2019), abs (2019 - (r `mod` 2019))]
    let ans = if (r `div` 2019) - (l `div` 2019) >= 1 
        then
            0
        else
            if distl < distr
                then distl * (distl + 1)
                else distr * (distr + 1)

    print ans