Code for problem 69D.