problem 39 solved