l, r = gets.split.map(&:to_i)

ary = []

for i in l .. [r, l + 5000].min
  ary << i % 2019
end

ans = 2018

for i in 0 .. ary.size - 2
  for j in i + 1 .. ary.size - 1
    ans = [ans, (ary[i] * ary[j]) % 2019].min
  end
end

puts ans
