Bakayev E.V.

In each cell of a $1000 \times 1000$ square, a number is inscribed such that in any rectangle of area $s$ that does not extend beyond the square and whose sides lie along the cell boundaries, the sum of the numbers is the same. For which $s$ will the numbers in all cells necessarily be the same?
It is clear that when $s=1$, the numbers in all cells are the same.

Let $s>1$ and $p$ be a prime divisor of $s$. In cells where the sum of the coordinates is divisible by $p$, we write ones, and in the other cells, we write zeros. In any rectangle $T$ of area $s$, one of the sides is divisible by $p$, so it is divided into $s / p$ strips of length $p$. Each such strip contains exactly one one. Therefore, the sum of the numbers in $T$ is ${ }^{s} / p$, which does not depend on the choice of the rectangle.

## Answer

Only when $s=1$.