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

min = 2019
if 2019 <= (l - r).abs
  puts 0
else
  (l..r - 1).each do |i|
    (i + 1..r).each do |j|
      m = (i * j) % 2019
      min = m if m < min
    end
  end
end

puts min
