You are given a binary string of length consisting only of 0 and 1. The first character of is always 0.
You may perform the following operation any number of times.
- Choose a contiguous substring of the current string whose length is at least .
- Inside the chosen substring, the number of
1s must be exactly one greater than the number of0s. - Choose one
1inside the chosen substring and change it to0.
Among all strings obtainable after performing the operation zero or more times, find the minimum possible number of 1s.
Input
The input is given from Standard Input in the following format:
Each case is given in the following format:
Output
For each test case, print one line containing the minimum possible number of 1s in an obtainable string.
Constraints
- .
- .
- .
- is either
0or1(). - .
- The sum of over all test cases does not exceed .
Subtasks
Samples
The first test case initially contains no 1.
In the second test case, the whole string 011 can be chosen and one 1 can be changed to 0.
In the third and fourth test cases, it is impossible to obtain a string with fewer 1s than the printed value.