Task 3, added solution.