Completed problem 4.31