[<AutoOpen>]
module Program

open System

let read f = stdin.ReadLine() |> f
let reada f = stdin.ReadLine().Split() |> Array.map f
let reads f = stdin.ReadLine().Split() |> Array.toList |> List.map f

[<EntryPoint>]
let main _ =
    let [l;r] = reads int
    let xs = [| for i = l to min r (l + 2018) do yield i % 2019 |]
    seq {
        for i = 0 to Array.length xs - 1 do
            for j = i + 1 to Array.length xs - 1 do
                yield xs.[i] * xs.[j] % 2019
    }
    |> Seq.min
    |> printfn "%i"
    0