finished problem 39