фзestiev I.V.

There are three piles of stones. Sisyphus carries one stone from one pile to another. For each transfer, he receives from Zeus an amount of coins equal to the difference in the number of stones in the pile where he places the stone and the number of stones in the pile from which he takes the stone (the stone being moved is not counted). If the specified difference is negative, Sisyphus returns the corresponding amount to Zeus. (If Sisyphus cannot pay, the generous Zeus allows him to make the transfer on credit.) At some point, it turned out that all the stones were in the same piles as they were initially. What is the maximum total earnings of Sisyphus at this moment?
We will call stones from the same pile acquaintances, and from different piles - strangers. Then Sisyphus's income for one relocation is equal to the change in the number of pairs of acquainted stones. Since in the final moment all stones ended up in their original piles, the total change in the number of acquaintances is zero, and therefore Sisyphus's income is zero.

## Answer

## Problem