solved problem 31