a,b = gets.split.map(&:to_i)

ans = 0
if (b-a) < 2019
  (b-a).times do |i|
		if ans != 0
    	if ans > a.modulo(2019) * (a+1).modulo(2019)
    	  ans = a.modulo(2019) * (a+1).modulo(2019)
    	end
		else
			ans = a.modulo(2019) * (a+1).modulo(2019)
		end
  end
else
  ans = 0
end

puts ans.modulo(2019)
