International Tournament in Informatics 24 November, 2012, Shumen, Bulgaria Junior Group Task B1. Balance
International Tournament in Informatics 24 November, 2012, Shumen, Bulgaria Junior Group Task B1. Balance
4
10
1 1
1
1 1 1 2 1
Output
25
Explanation of the example
The sequence of taken balls is 2 + 2 + 3 + 5 + 5 + 8. From the 5th, 6th, 7th and 10th
boxes, nothing is taken.