Problem 008 solution.