L, R = gets.split.map(&:to_i)

if R - L + 1 >= 2019
  
  ans = 0
  
else
  
  ans = 2018
  (L..R).each do |i|
    (L..R).each do |j|
      next unless i < j
      ans = [ans, i * j % 2019].min
    end
  end
  
end

puts ans