to solve problem 4