#P6284. [COCI 2016/2017 #1] Tarifa
[COCI 2016/2017 #1] Tarifa
Description
To be able to surf the Internet, Pero bought a data plan:
- Each month, he gets of data.
- Any unused data from a month can be carried over to the next month.
Now we know how many of data Pero used in each of the first months of this plan. Please calculate how many of data he can use in month .
Input Format
The first line contains an integer .
The second line contains an integer .
The next lines each contain an integer , which indicates how many of data Pero used in month .
Output Format
Output one line with one integer, representing how many of data Pero can use in month .
10
3
4
6
2
28
10
3
10
2
12
16
15
3
15
10
20
15
Hint
Sample 1 Explanation
In the first month, Pero can use of data. He actually uses , leaving .
In the second month, Pero can use of data. He actually uses , leaving .
In the third month, Pero can use of data. He actually uses , leaving .
In the fourth month, Pero can use of data.
Constraints
For of the testdata, it is guaranteed that , , and .
Notes
This problem is translated from COCI2016-2017 CONTEST #1 T1 Tarifa.
Translated by ChatGPT 5
京公网安备 11011102002149号