How do you calculate ending inventory?