solves problem 14