Problem 1 solution.