Code for problem 125.