Man sentenced to 40 years in 1997 death of teen girl