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

let rec lToM i =
    seq{
        match m - i <= 0 with
        |true -> () 
        |false -> 
            yield i
            yield! lToM (i+1)
        }

match lToM l |> Seq.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
