problem 40 solved