Problem 37 solution.