def chmin(a, b) a < b ? a : b end

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

res = 3000
num = 0
(L..R).each do |i| 
  res = chmin(i % 2019, res)
  if res.zero?
    puts 0
    exit
  end
end

puts res * (res + 1)
