4. A $10 \times 10$ table is filled with the numbers $-4, 3$, and 10 such that the sum of the numbers in each row, except one, is at most 0, and the sum of the numbers in each column, except one, is at most 0. Determine the greatest possible sum of the numbers in the table.

(Radovan Švarc)
SOLUTION. Let's first consider what the largest possible sum in a row of the table could be if it is composed of the numbers $-4, 3$, and 10 and must be at most 0. Notice that all three numbers -4, 3, and 10 give a remainder of 3 when divided by seven. Therefore, the sum of ten numbers in the same row will give the same remainder when divided by seven as the number $10 \cdot 3=30$, which is a remainder of 2. The largest non-positive number with this property is -5. In each of the nine rows where the sum is non-positive, the sum must therefore be at most -5. In the last row, for which we have no restrictions, the sum is at most $10 \cdot 10=100$. Therefore, the total sum of the numbers in the table certainly does not exceed $9 \cdot(-5)+100=55$.

Now let's find a $10 \times 10$ table with a sum of 55 that meets the conditions given in the problem. The previous paragraph suggests how to look for it, especially if we realize that a sum of -5 in a row or column can be achieved by using two tens, one three, and seven minus fours, since $2 \cdot 10+1 \cdot 3+7 \cdot(-4)=-5$. Therefore, we will fill the last row and the last column with tens and try to fill the remaining $9 \times 9$ table so that in each of its rows and also in each of its columns there is one ten, one three, and seven minus fours. This can be achieved by a method based on cyclically shifting the order of numbers in the rows (and thus also in the columns):

| 10 | 3 | -4 | -4 | -4 | -4 | -4 | -4 | -4 | 10 |
| ---: | ---: | ---: | ---: | ---: | ---: | ---: | ---: | ---: | ---: |
| -4 | 10 | 3 | -4 | -4 | -4 | -4 | -4 | -4 | 10 |
| -4 | -4 | 10 | 3 | -4 | -4 | -4 | -4 | -4 | 10 |
| -4 | -4 | -4 | 10 | 3 | -4 | -4 | -4 | -4 | 10 |
| -4 | -4 | -4 | -4 | 10 | 3 | -4 | -4 | -4 | 10 |
| -4 | -4 | -4 | -4 | -4 | 10 | 3 | -4 | -4 | 10 |
| -4 | -4 | -4 | -4 | -4 | -4 | 10 | 3 | -4 | 10 |
| -4 | -4 | -4 | -4 | -4 | -4 | -4 | 10 | 3 | 10 |
| 3 | -4 | -4 | -4 | -4 | -4 | -4 | -4 | 10 | 10 |
| 10 | 10 | 10 | 10 | 10 | 10 | 10 | 10 | 10 | 10 |

Conclusion. The largest possible sum of the numbers in the table is 55.