A Prescription for Optimal Inventory Management