open System

// 2000 2100
// 2000 91 -> 0

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


let [|i; j|] = stdin.ReadLine().Split() |> Array.map (fun x -> int(x) % 2019)

if 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