Code for problem 442B.