## Task A-4.5.

Given is a board of dimensions $2020 \times 2022$. Two fields of this board are said to be adjacent if they share a common side or if they are at the beginning and end of the same row or column. Thus, each field has exactly four adjacent fields.

Viktor, in each step, chooses one field of the board and places five tokens on the board: one on the chosen field and one on each of the adjacent fields. After a finite number of such steps, there are exactly $d$ tokens on each field.

Determine the smallest possible $d$.
## Solution.

We will say that a move has been made on some field if Viktor has chosen that field on the board, and placed a token on that field and the four neighboring fields.

We will prove that the smallest possible $d$ is 5. This number of tokens can be achieved by Viktor making a move on each field exactly once. This way, we have placed a token on each field once when we made a move on that field, and four more times when we made a move on one of its neighbors.

Now let's prove that it is necessary that $d \geqslant 5$. Assume that after a finite number of moves, there are exactly $d$ tokens on each field of the board.

Color the board with 5 colors such that every fifth row is colored the same color. Denote the colors of the first five rows as $1,2,3,4,5$, respectively. For the index $i \in\{1,2,3,4,5\}$, let $x_{i}$ be the total number of moves made on all fields of color $i$.

Each row contains 2022 fields, and color $i$ is used to color 404 rows. Therefore, the total number of tokens on all fields colored with color $i$ is $d \cdot 2022 \cdot 404$. On the other hand, on fields colored with color $i$, we would place 3 tokens with each move made on a field colored with color $i$, and one token with each move made on a field colored with color $i-1$ and $i+1$. Therefore, for each $i$, we conclude that the following equality holds:

$$
x_{i-1}+3 x_{i}+x_{i+1}=d \cdot 2022 \cdot 404
$$

where we identify $x_{0}=x_{5}$, and $x_{6}=x_{1}$. Sum all 5 obtained equalities, and divide the result by 5. We get

$$
x_{1}+x_{2}+x_{3}+x_{4}+x_{5}=d \cdot 2022 \cdot 404
$$

Now subtract the last equality from the previous 5 obtained. We get a system of 5 equations with 5 unknowns:

$$
\begin{aligned}
& x_{4}-2 x_{1}+x_{3}=0, \\
& x_{5}-2 x_{2}+x_{4}=0, \\
& x_{1}-2 x_{3}+x_{5}=0, \\
& x_{2}-2 x_{4}+x_{1}=0 \\
& x_{3}-2 x_{5}+x_{2}=0 .
\end{aligned}
$$

We will prove that the only solution to this system in non-negative integers is when all numbers $x_{i}$ are equal. Without loss of generality, let $x_{1}$ be the largest among them. Then from the first equation of the system, we get

$$
x_{4}+x_{3}=2 x_{1} \geqslant x_{3}+x_{4}
$$

where equality holds only if $x_{1}=x_{3}=x_{4}$. Now from the third equation of the system, we get

$$
x_{5}=2 x_{3}-x_{1}=x_{1}
$$

and from the fourth

$$
x_{2}=2 x_{4}-x_{1}=x_{1}
$$

Thus, we have obtained that all $x_{i}$, for $i \in\{1,2,3,4,5\}$, are equal. For their sum, we have

$$
5 x_{1}=x_{1}+x_{2}+x_{3}+x_{4}+x_{5}=d \cdot 2022 \cdot 404
$$

Since the left side of the equality is divisible by 5, the right side must also be. This is possible only if $5 \mid d$, and since $d$ is a natural number, in particular, $d \geqslant 5$.

Therefore, the smallest possible such $d$ is 5.