You meet a guy on the road. The following conversation follows:
He: Let's play a game. Give me any natural number from $3$ to $10$. I'll call this number the grid size
You: Okay, $4$.
(He draws a $4$x$4$ grid on a sheet of paper, since you picked $4$)
He: Now give me another integer. Try to give a small one to make our calculations easy. This number will be called our 'sum'.
You: Okay, $9$.
He: Now give me any $4$ integers that add up to $9$.
(He writes them on the diagonal of the grid)
He: Now give me any $3$ (as $3$ is 1 less than $4$) integers, completely at random.
(He writes them on the first row, starting with the 2nd cell, since the first cell was already filled)
The grid looks like
3 9 14 -5 -1 2 5
He fills the rest of the grid himself.
3 9 14 -5 -7 -1 4 -15 -9 -3 2 -17 13 19 24 5
He: Now pick any $4$ cells, such that no $2$ cells share the same row or column.
You: Okay, the $9$ on top, the $4$ in the next row, $-9$ in the third row, and the leaves only $5$ on the last cell.
He: Now add them up.
You: It's $9$! The number I originally picked.
He: Try another set of $4$.
You: which again add up to $9$.
What 'trick' did he use, and can you defeat him? Does a exist an allowed grid size and set of input numbers, for which such a 'magic cutting grid' cannot be generated?