8. (40 points) On one of the planets in the Alpha Centauri system, elderly women love to paint the cells of $2016 \times 2016$ boards with gold and silver paints. One day, it turned out that in all the boards painted that day, each $3 \times 3$ square had exactly $A$ gold cells, and each $2 \times 4$ or $4 \times 2$ rectangle had exactly $Z$ gold cells. For which values of $A$ and $Z$ is this possible?
Answer: $A=Z=0$ or $A=9, Z=8$.

Solution: Divide the board into $2 \times 2$ squares. If a $2 \times 2$ square contains $u$ gold cells, then an adjacent $2 \times 2$ square must contain $v=Z-u$ gold cells. Therefore, $2 \times 2$ squares containing $u$ and $v$ gold cells alternate in a checkerboard pattern. Consider a $6 \times 6$ square composed of $2 \times 2$ cells. Since it can be divided into four $3 \times 3$ squares, it should contain $4 A$ gold cells. However, there are $6 \times 6$ squares on the board with $4 u+5 v$ gold cells and $6 \times 6$ squares with $5 u+4 v$ gold cells. Therefore, $u=v$, and $9 u=4 A$. This means that $u$ is divisible by 4, so either $u=0$ or $u=4$. In the first case, all cells on the board are silver and $A=Z=0$, in the second case, all cells are gold, and $A=9, Z=8$.