solved problem 39.