Guilherme wrote 0 or 1 in each cell of a $4 \times 4$ board. He placed the numbers in such a way that the sum of the numbers in the neighboring cells of each cell on the board was equal to 1.

For example, in Figure 40.1, considering the cell marked with $\bullet$, the sum of the numbers in the shaded cells is equal to 1.

![](https://cdn.mathpix.com/cropped/2024_05_01_f834661fc4998f822873g-6.jpg?height=331&width=297&top_left_y=571&top_left_x=1051)

Determine the sum of all 16 numbers on the board.
Each house can only have one neighbor with a number 1, and the other neighbors must be zeros, since the sum of the neighbors is 1.

Starting from the top left corner, we can assume without loss of generality that we fill the board as shown in Figure 40.2.

In the following steps, the filled cells are the neighbors of the marked cell.

In each step, the numbers filled in are unique to respect the conditions of the problem.

The sum of the numbers in the filled cells is 3. By making a similar analysis, starting from the bottom left corner or the top right corner, we conclude that the sum of the numbers in the other cells is also equal to 3.

Therefore, the sum of the numbers placed on the board is always equal to 6.