Code for problem 67D.