You work at a bakery and every day you make exactly 100 bagels. However your customers are not as reliable and every day a random number of bagels will be ordered. So sometimes you will run out of bagels and sometimes you will have leftovers.
Now leftover bagels will still be good for 1 more day. After a day on the shelves they have to be tossed. But until then you can still sell them. So you keep them for the next day. Customers will prefer fresh bagels so if you haven't run out of fresh bagels they will get a fresh bagel. Only when you are out of fresh bagels will they ask for a day-old bagel.
So for example if you have have 25 bagels left over one day and the next day 100 bagels are ordered, you don't sell any of the old bagels so you throw them out and have 0 leftover bagels the next day.
Your task is to write a program or function which takes a non-empty list of non-negative integers representing how many orders were placed in a given time:
e.g.
[106,25,134,99,85,12]
means that on the first day 106 bagels were ordered, on the second day 25 bagels were ordered and then 134 etc.
Your task is to calculate how many bagels were sold in the described period. You should assume that at the start of the period there will be no leftover bagels available.
This is code-golf so answers will be scored in bytes with fewer bytes being the goal.
Test cases
[100,100,100] -> 300
[372,1920,102] -> 300
[25,25,25] -> 75
[25,100,120] -> 225
[0,200] -> 200
[0,175,75] -> 250
[75,150,150] -> 300
[0,101,199]-> 201
[200,0] -> 100