l,r = gets.chomp.split.collect{ |item| item.to_i}
result = 2018
imax = [l+2019,r].min
l.upto(imax) do |i|
  break if result == 0
  jmax = [i+2020,r].min
  (i+1).upto(jmax) do |j|
    ans = ((i*j) % 2019)
    result = [result,ans].min
  end
end

puts result