let () = Scanf.scanf "%d %d" @@ fun l r ->
  Printf.printf "%d\n" @@
  if
    l = 0 ||
    1 <= r / 673 - (l - 1) / 673 &&
    1 <= r / 3 - (l - 1) / 3
  then 0
  else
    Array.fold_left (Array.fold_left min) max_int @@
    Array.init (r - l + 1) @@ fun i ->
      Array.init (r - l + 1) @@ fun j ->
        let i = i + l in
        let j = j + l in
        if j <= i
        then max_int
        else (i * j) mod 2019

