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

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

puts num.eql?(R) ? (res - 1) * res : res * (res + 1)
