Martinsville doctor sentenced to 40 years for drug distribution