solved problem 1
solved problem 2
solved problem 3
solved problem 4