open System

// 2000 2100
// 2000 91 -> 0

// 2020 2040
// 1 21 -> 1 * 2 


let [|L; R|] = stdin.ReadLine().Split() |> Array.map int

let i, j = L%2019, R%2019
if R - L >= 2019 || i >= j then 0
else List.min [ for l in i..j-1 ->
                  List.min [ for r in l+1..j -> l * r % 2019 ]
              ]
|> stdout.WriteLine