solved problem 3.