Solutions for tasks 3.8, 3.9 added