added solution for problem 31