Dynamic Inventory Management with Learning About the Demand Distribution and Substitution Probability