Task2 from hw5.

Unfortunately, wrong answer:(
But the solving way seems to be right.