Implemented problem 9.