#T517. 【NOIP2004-S1】津津的储蓄计划

【NOIP2004-S1】津津的储蓄计划

Description

Jinjin's pocket money has always been managed by herself. At the beginning of each month, her mother gives her 300 yuan. Jinjin budgets her expenses for the month and always ensures that her actual spending matches the budget.

To teach Jinjin about saving, her mother proposed that Jinjin can deposit any whole hundred yuan with her at any time. At the end of the year, her mother will return the deposited amount plus 20%. Therefore, Jinjin devised a savings plan: at the beginning of each month, after receiving the pocket money from her mother, if she expects to have more than or exactly 100 yuan left by the end of the month, she will deposit the whole hundred yuan with her mother and keep the remaining money for herself.

For example, at the beginning of November, Jinjin had 83 yuan left, and her mother gave her 300 yuan. Jinjin budgeted 180 yuan for November, so she would deposit 200 yuan with her mother and keep 183 yuan for herself. By the end of November, Jinjin would have 3 yuan left.

Jinjin realized that the main risk of this savings plan is that the money deposited with her mother cannot be withdrawn before the end of the year. It is possible that at the beginning of a certain month, the money Jinjin has on hand plus the pocket money from her mother might not be enough to cover the original budget for that month. If this happens, Jinjin will have to tighten her belt and reduce her budget for that month.

Now, based on Jinjin's monthly budgets from January to December 2004, please determine whether such a situation will occur. If not, calculate how much money Jinjin will have at the end of 2004 after her mother returns the deposited money plus 20%.

Input Format

The input consists of 12 lines, each containing a non-negative integer less than 350, representing Jinjin's budget for each month from January to December.

Output Format

The output consists of a single line containing one integer. If a month occurs where Jinjin does not have enough money, output -X, where X is the first such month; otherwise, output the total amount of money Jinjin will have at the end of 2004 after her mother returns the deposited money plus 20%.

```input1 290 230 280 200 300 170 340 50 90 80 200 60 ``` ```output1 -7 ``` ## Source

NOIP2004-S1