Task2 and Task2.1 solution from Roman Besolov.