Added problem 8.
Implemented problem 8.