finish problem 40