#T720. 【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, and Jinjin budgets her expenses for the month, always ensuring that her actual spending matches the budget.

To teach Jinjin how to save, her mother proposed that Jinjin can deposit any whole hundred yuan with her at any time, and at the end of the year, she will return it with an additional 20%. Therefore, Jinjin devised a savings plan: at the beginning of each month, after receiving her 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 money her mother gives her for that month may not be enough to cover the original budget. If this happens, Jinjin will have to tighten her belt and cut down on her budget for that month.

Now, based on Jinjin's monthly budgets from January to December 2004, 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 money she usually deposits plus 20%.

Input Format

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

Output Format

The output consists of one line containing a single integer. If there is a month where the money is insufficient during the implementation of the savings plan, output -X, where X is the first month this situation occurs; otherwise, output the amount of money Jinjin will have at the end of 2004.

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

NOIP2004-S1

(Note: NOIP stands for National Olympiad in Informatics in Provinces, a Chinese programming competition for secondary school students. "S1" likely indicates this is the first problem set from the 2004 edition.)

(The original text only provides the competition identifier without additional context. In English academic/competitive programming contexts, such identifiers are typically preserved as-is while adding a brief explanation for international readers.)