Solved 3rd task in Section 1.4