Exercise 3 solution