#P3040. [USACO12JAN] Bale Share S
[USACO12JAN] Bale Share S
Description
FJ has hay bales, and the weight of the -th bale is . He wants to distribute the hay as evenly as possible among three farms.
He wants the maximum total weight after distribution to be as small as possible. For example, let be the total weights assigned to the three farms after distribution. Assume . He wants the value of to be as small as possible.
Please compute the minimal possible value of .
Input Format
The first line contains a positive integer .
Each of the next lines contains a positive integer representing a weight.
Output Format
Output a single line containing one integer, the answer.
8
14
2
5
15
8
9
20
4
26
Hint
[Sample Explanation]
One valid distribution is:
Farm 1: , .
Farm 2: , .
Farm 3: , .
Constraints
For of the testdata, , .
Translated by ChatGPT 5
京公网安备 11011102002149号