Code for problem 85B.