## Task 2.

For a natural number $n$, we consider a $2020 \times n$ table where each cell contains either 1 or -1. Let $a_{j}$ be the product of all numbers in the $j$-th row, and $b_{i}$ be the product of all numbers in the $i$-th column. Determine all natural numbers $n$ for which it can hold that

$$
a_{1}+a_{2}+\cdots+a_{2020}+b_{1}+\cdots+b_{n}=0
$$
## Solution.

The sum of $2020+n$ numbers is 0, each of these numbers is 1 or -1. This means that there is an even number of these numbers, from which we conclude that the number $2020+n$ is even, or we conclude that the number $n$ must be even.

Notice that the numbers $a_{1} \cdot a_{2} \cdots a_{2020}$ and $b_{1} \cdot b_{2} \cdots b_{n}$ are equal. Both of these numbers are equal to the product of all the numbers written in the table. Thus, the number of occurrences of the number -1 among the numbers $a_{1}, a_{2}, \ldots, a_{2020}$ has the same parity as the number of occurrences of the number -1 among the numbers $b_{1}, b_{2}, \ldots, b_{n}$. We conclude that the total number of -1s is even, and since this number is equal to $1010+\frac{n}{2}$, we conclude that the number $\frac{n}{2}$ is even, i.e., the number $n$ must be divisible by 4.

We claim that for any natural number $n$ that is divisible by 4, the desired equality can hold. It remains to provide an example for 2020 rows and $n$ columns.

Let $n=4k$, we know that among the numbers $a_{1}, a_{2}, \ldots, a_{2020}, b_{1}, b_{2}, \ldots, b_{n}$ there must be $1010+2k$ numbers equal to -1.

In the first column of the table, let the numbers in rows $2,3, \ldots, 1011$ be equal to -1. Furthermore, in the first row of the table, let the numbers in columns $2,3, \ldots, 2k+1$ be equal to -1. All other numbers in the table are equal to 1.

We see that $a_{1}=a_{1012}=\cdots=a_{2020}=1$ and $a_{2}=a_{3}=\cdots=a_{1011}=-1$. Also, $b_{1}=b_{2k+2}=\cdots=b_{4k}=1$ and $b_{2}=b_{3}=\cdots b_{2k+1}=-1$. Therefore, it holds that

$$
a_{1}+a_{2}+\cdots+a_{2020}+b_{1}+b_{2}+\cdots+b_{n}=0
$$