l, r = gets.chomp.split(' ').map(&:to_i)
if ((r-1) * r) < 2019 then
  puts ((r-1) * r)
elsif ((r-1) * r) == 2019 then
  puts 0
else

result = []
l.upto(r-1) do |i|
  (i+1).upto(r) do |j|
    result << mod = (i * j) % 2019
  end
end  
puts result.min
end
