Problem 006 solution.