solve problem 7
solve problem 8