Who among us does not remember an instructive story about how Tom Sawyer's aunt Polly's job was painting the fence: "Sighing, he dipped the brush into the bucket, picked up a Board fence, repeated the operation did it again..." (mark TWAIN. The Adventures Of Tom Sawyer).
Let us construct the algorithm for painting the fence. Suppose that we have a paint brush and enough paint. Write, for example, the following sequence of actions: