solve problem 4
solve problem 7
solve problem 8