solve exercise 5.1