Problem 100 solution