#P1089. [NOIP 2004 提高组] 津津的储蓄计划

[NOIP 2004 提高组] 津津的储蓄计划

Description

Jinjin manages her pocket money by herself. At the beginning of each month, mom gives Jinjin 300300 yuan. Jinjin makes a budget for that month’s expenses, and she always keeps the actual expenses equal to the budget.

To teach Jinjin how to save, mom proposes that Jinjin may deposit any whole hundreds with her at any time, and at year end she will add 20%20\% and return it to Jinjin. Therefore, Jinjin makes a savings plan: at the beginning of each month, after receiving the pocket money from mom, if she expects that by the end of this month she will have at least 100100 yuan left on hand, she will deposit all the full hundreds with mom, keeping the remainder herself.

For example, at the beginning of month 1111, Jinjin still has 8383 yuan on hand, and mom gives 300300 yuan. Jinjin plans to spend 180180 yuan in month 1111, so she deposits 200200 yuan with mom and keeps 183183 yuan. By the end of month 1111, Jinjin will have 33 yuan left.

Jinjin finds that the main risk of this savings plan is that the money deposited with mom cannot be withdrawn before year end. It may happen that at the beginning of some month, the money Jinjin has on hand plus this month’s money from mom is not enough for that month’s original budget. If this happens, Jinjin will have to scrimp that month and cut the budget.

Now, given Jinjin’s monthly budgets from January to December of year 20042004, determine whether such a situation occurs. If not, compute how much money Jinjin will have on hand at the end of year 20042004, after mom returns the deposited money plus 20%20\% to Jinjin.

Input Format

1212 lines of data, each containing a non-negative integer less than 350350, representing the budgets for months 11 through 1212.

Output Format

A single integer. If, during the implementation of the savings plan, there is a month when the money is not enough, output X-X, where XX is the first such month; otherwise, output how much money Jinjin will have on hand at the end of year 20042004.

Note that on Luogu you should use standard input and output, not file I/O.

290
230
280
200
300
170
340
50 
90 
80 
200
60 

-7 

290 
230 
280 
200 
300 
170 
330 
50 
90 
80 
200 
60 

1580

Hint

Translated by ChatGPT 5