prob-16 solution