Working answer for question 4