How do we compute the cost of capital of companies using weighted averages?