open System

let L,R=stdin.ReadLine().Split()|>fun c -> (int c.[0] |> fun c ->c%2019), (int c.[1]|>fun c -> c%2019)
[<EntryPoint>]
let main argv =
    let S = if L<=R then [L..(R-1)] else [0]
    [for i in S do
        for j in [i+1..R] do 
            yield (i*j)%2019]
    |>List.min
    |>stdout.WriteLine
    0