Solution for task 3 (10.09.14)