local l, r = io.read("*n", "*n")
if 2020 < r - l then
  print(0)
else
  local ret = 2018
  local mmi = math.min
  for i = l, r - 1 do
    for j = i + 1, r do
      ret = mmi(ret, (i * j) % 2019)
    end
  end
  print(ret)
end
