Exercise 3. Task 3. Algorithm preparation