input_line = gets.chomp.split(" ")
l = input_line[0].to_i
r = input_line[1].to_i
i = 1
while 2019 * i < l do
  i += 1
end
n2019 = 2019 * i
if (r % 2019 == 0) || (l <= n2019 && n2019 < r) then
  puts 0
else
  imod = l%2019
  puts imod*(imod+1)
end
#puts l,r,lt,rt