Endogenous Technology Adoption and Medical Costs