Waste for heating and cooling: how district energy transforms losses into gains