solove::Int -> Int -> Int
solove l r = minimum [(i*j)| i<-[l..r-1],j<-[i+1..r]]

main::IO ()
main = do
    [l,r] <- map read . words <$> getLine
    let [nl,nr] = map (`mod` 2019) [l,r]
    print $ solove nl nr