open System

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