let [| l; m; |] = stdin.ReadLine().Split() |> Array.map int

match seq{l..m} |> Seq.exists (fun x -> x % 2019 = 0 ) with 
|true -> 0
|false -> 
    let list = [l..m] |> List.map (fun x -> x % 2019)
    list |> List.allPairs list |> List.filter (fun (x1,x2) -> x1 < x2)
    |> List.map (fun (x1,x2) -> x1 * x2 % 2019)
    |> List.min
|> stdout.WriteLine