Code for problem 98A.
Code for problem 47E.