A game where starting with 3 boxes, with 10 balls in each, the goal is to remove as many balls as possible following the rules This is a Norwegian olympiad problem:

Peter has three boxes, with ten balls in each. He plays a game where the goal is to end up with as few balls as possible in the boxes. The boxes are each marked with a separate number: $4$, $7$, and $10$. It is allowed to remove $N$ balls from the box marked with the number $N$, put three aside, and put the rest of them in another box. What is the least possible number of balls the boxes can contain together in the end?

*

*$0$ balls.

*$2$ balls.

*$3$ balls.

*$5$ balls.

*$6$ balls.


How should I solve this?
Is it trial, error what is this? I cant get any of the choices.
Suppose I choose $N = 10$ box. Then,
You transfer $7$ to get $7 + 10 + 10 = 27$ balls in the other two, sum.
But I can't get anything below $10$, how to do this?
 A: Here is one way to end up with $3$ balls total (which is the minimum possible by the comments above): First take all the balls in the $10$-bin, put $3$ aside, and put the last $7$ into the $4$-bin. You now have $(17, 10, 0)$ balls.
Take $7$ balls from the $7$ bin, put three aside and the rest in the $4$-bin. You now have $(21, 3, 0)$ balls.
Take four balls from the $4$-bin, put three of them aside and the last one into the $7$-bin. Do this four more times. You now have $(1, 8, 0)$ balls.
Take $7$ balls from the $7$-bin, put three of them aside and the rest into the $4$-bin. You now have $(5, 1, 0)$ balls.
Lastly, take four balls from the $4$-bin, put three aside and one into the ten bin. There is now one ball in each bin, so you have $3$ balls left.
A: Perhaps the most elegant solution is to take all $10$ from the $10$-box and deposit the excess $7$ in the $7$-box. Then remove those $7$ and deposit the excess $4$ in the $4$-box. Then remove those $4$ and deposit the excess ball in the $10$-box. Now apply the same idea to the $7$-box: remove all $7$, deposit the excess $4$ in the $4$-box, immediately remove them, and deposit the excess ball in the $10$-box. Finally, remove the $4$ in the $4$-box and deposit the excess ball in the $10$-box. You now have $3$ balls in the $10$-box.
The key observation here is that you can reduce the contents of any box to a single ball (not necessarily in the same box) by depositing the excess balls in successively ‘smaller’ boxes.
