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

match [l..m] |> List.exists (fun x -> x % 2019 = 0 ) with 
|true -> 0
|false -> 
    [for i in l..m do for j in i+1..m -> i,j] |> List.map (fun (x1, x2) -> (x1 % 2019, x2 % 2019))
    |> List.map (fun (x1,x2) -> x1 * x2 % 2019)
    |> List.min
|> stdout.WriteLine