problem 39
problem 40