final solution to problem 25