total cost of inventory formula