solved problem 7
solved problem 8
solved problem 9