[<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 [ll;rr] = reads int
    let l = ll % 2019
    let r = rr % 2019
    seq {
        for i = l to r do
            for j = i + 1 to r do
                yield i * j % 2019
    }
    |> Seq.min
    |> printfn "%i"
    0