Code for problem 37A.