Problem 7.4. Seven boxes are arranged in a circle, each containing several coins. The diagram shows how many coins are in each box.

In one move, it is allowed to move one coin to a neighboring box. What is the minimum number of moves required to equalize the number of coins in all the boxes?
![](https://cdn.mathpix.com/cropped/2024_05_06_d3a039ae044fd2dec0bcg-19.jpg?height=558&width=556&top_left_y=1158&top_left_x=446)
Answer: 22.

Solution. Note that there are a total of 91 coins, so after all moves, each box should have exactly 13 coins. At least 7 coins need to be moved from the box with 20 coins. Now consider the boxes adjacent to the box with 20 coins. Initially, they have a total of 25 coins, and at least 7 more coins will be transferred from the box with 20 coins. In the end, these two boxes should have a total of 26 coins, so at least \(25 + 7 - 26 = 6\) coins need to be moved from these boxes. Next, consider the boxes with 17 and 18 coins, from which at least 4 and 5 coins need to be moved, respectively. In total, there should be at least \(7 + 6 + 4 + 5 = 22\) moves.

Let's provide an example of how to equalize all the boxes in exactly 22 moves. From the box with 20 coins, we move 3 coins to the box with 10 (it becomes 13), and 4 coins to the box with 15 (it becomes 19). From the box that now has 19 coins, we move 6 coins to the box with 5 coins (it becomes 11). From the box with 17 coins, we move 2 coins to the box with 11, and 2 coins to the box with 6 (it becomes 8). Finally, we move 5 coins from the box with 18 coins to the box with 8 coins. In the end, each box has exactly 13 coins. It is easy to verify that exactly 22 moves were made.

![](https://cdn.mathpix.com/cropped/2024_05_06_d3a039ae044fd2dec0bcg-20.jpg?height=607&width=583&top_left_y=712&top_left_x=435)