Code for problem 386B.