Exchange between three heroes
In many strategy games, when two heroes from the same player meet, they can exchange troops. A novice programmer, Petryk, decided to create his own game, incorporating a similar exchange feature but involving three heroes. Petryk also introduced some restrictions on this exchange process.
The exchange can occur over several moves. In each move, the player selects one warrior from the army of one hero and another warrior from the army of a different hero. These warriors swap places, meaning the first warrior joins the second hero's army, and the second warrior joins the first hero's army. However, if at any point during the exchange, one of these warriors was already part of the army they are being transferred to, such a move is deemed invalid and is not executed.
Petryk wants to implement a feature to undo any number of the last moves made during the exchange. To do this, he needs to store information about these moves, which requires memory allocation. Petryk knows his memory manager is not very efficient, so he plans to call it only once at the start of the exchange. Therefore, it is necessary to estimate in advance the maximum number of moves a player can make in the exchange between three heroes, given a known number of warriors.
Input
The input consists of a single line containing three integers n_1, n_2, and n_3 (0 ≤ n_i ≤ 30), which represent the number of warriors in the armies of the first, second, and third heroes, respectively.
Output
Output a single number representing the maximum possible number of moves in the exchange between these heroes.