Optimal savings and health spending over the life cycle