local mce, mfl, msq, mmi, mma = math.ceil, math.floor, math.sqrt, math.min, math.max
local l, r = io.read("*n", "*n")

local ret = 2019
local imax = mmi(l + 2018, r - 1)
for i = l, imax do
  local jmax = mmi(i + 1 + 2018, r)
  for j = i + 1, jmax do
    local cand = ((i % 2019) * (j % 2019)) % 2019
    ret = mmi(ret, cand)
  end
end
print(ret)
