Solved exercise 2