Implemented problem 17