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