Monopolistic Competition with Endogenous Specialization