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

answer = 2019
(l..(r - 1)).each do |i|
  ((i + 1)..r).each do |j|
    res = i * j % 2019
    answer = res if res < answer
    break if answer == 0
  end
  break if answer == 0
end

puts answer