solved problem 29
solved problem 30