main = do
    [l, r] <- map read . words <$> getLine
    print $ minimum $ map (\(x, y) -> x * y `mod` 2019) $ comb2 [l..r]

comb2 :: [Int] -> [(Int, Int)]
comb2 [] = []
comb2 (x:xs) = [(x, y) | y <- xs] ++ comb2 xs
