l, r = gets.split.map(&:to_i)

def hoge(l, r)
  if (l..r).to_a.any?{|n| n % 673 == 0} && (l..r).to_a.any?{|n| n % 3 == 0}
    return 0
  end
  return (l % 2019) * ((l+1) % 2019)
end

if r < 2019
  puts hoge(l, r)
elsif l <= 2019 && 2019 <= r
  puts 0
else
  if r - l >= 2019
    puts 0
  else
    puts hoge(l, r)
  end
end