Calculate the cost of goods sold.