George is very passionate about the good old times, so much that he switched the illumination in his street to old-fashioned oil lanterns.
The street is now nicely illuminated by a sequence of equally spaced lanterns, providing joy and delight to the whole neighbourhood.
However, he got the permission for doing so only by accepting to personally maintain the lanterns lit up: in fact, he has to ensure that given any subsequence
of consecutive lanterns, at least of them are lit up at any given time.
Tonight an heavy storm is coming down on George's neighbourhood, and some particularly strong wind gusts just extinguished part of the lanterns. George can see for each lantern whether it is lit () or not ().
Since he doesn’t want to risk his concession to be revoked, it is time to get out in the storm and turn on some lights!
Task
Help George not to freeze in the storm, and find the minimum amount of lanterns which need to be lit up in order to comply with the city regulations!
Input data
The first line contains three integers , , .
The second line contains integers , such that if the corresponding lantern is off and if it is on.
Output data
You need to write a single line with an integer: the minimum number of lanterns which need to be lit up.
Constraints and clarifications
- for each
# | Points | Constraints |
---|---|---|
1 | 5 | Examples. |
2 | 10 | |
3 | 10 | |
4 | 20 | |
5 | 25 | |
6 | 30 | No additional constraints. |
Example 1
stdin
5 2 1
0 1 0 0 1
stdout
1
Explanation
It is sufficient to lit up the lantern with obtaining the following configuration: .
Example 2
stdin
12 4 2
0 0 0 0 1 0 1 0 0 0 1 0
stdout
3
Explanation
It is sufficient to lit up the lanterns with obtaining the following configuration: .