There are three boxes of stones. Each hour, Sisyphus moves a stones from one box to another. For each transfer of a stone, he receives from Zeus a number of coins equal to the number of stones in the box from which the stone is drawn minus the number of stones in the recipient box, with the stone Sisyphus just carried not counted. If this number is negative, Sisyphus pays the corresponding amount (and can pay later if he is broke).

After 1000 years, all the stones lie in their initial boxes. What is the greatest possible earning of Sisyphus at that moment?
The myth of Sisyphus suggests the answer: 0 .

Let $x$ be the amount of money Sisyphus has and $a, b, c$ the sizes of the boxes. The key observation is that the quantity

$$
N=2 x+a^{2}+b^{2}+c^{2}
$$

does not change; for example, after one operation from the first box to the second the quantity becomes

$N^{\prime}=2(x+a-b-1)+(a-1)^{2}+(b+1)^{2}+c^{2}=2 x+2 a-2 b-2+a^{2}-2 a+1+b^{2}+2 b+1+c^{2}=2 x+a^{2}+b^{2}+c^{2}=$

Thus the quantity $N$ is an invariant.

Consequently, if Sisyphus has no money to begin with then he does not earn any money at the end, either.