solve exercise 40.01