solved problem 3
solved problem 4
solved problem 5