let l, r = Scanf.scanf " %d %d" @@ fun a b -> a, b
let ans = ref max_int
let _ = Printf.printf "%d\n" @@ if r - l + 1 >= 2019 then 0 else
  (for i = l to r do
    for j = i + 1 to r do ans := min !ans @@ i * j mod 2019 done done;
  !ans)