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

main::IO ()
main = do
    lr <- map read . words <$> getLine
    let nlr = map (`mod` 2019) lr
    print $ solove nlr