l, r = gets.split.map(&:to_i)
r = [l + 2019, r].min

tmp_min = 2019
(l..r - 1).each do |i|
  (i + 1..r).each do |j|
    cand = i * j % 2019
    tmp_min = cand if tmp_min > cand
  end
end
puts tmp_min
