#include using namespace std; int main() { string S; cin >> S; int n = S.size(); int most_right_zero = 0; for (int i = n - 1; i >= 0; i--) { if (S.at(i) == '0') { most_right_zero = i; break; } } int ans = 0; bool plus = true; for (int i = 0; i < n - 2; i++) { if (S.at(i) == '1' && S.at(i+1) == '1' && S.at(i+2) == '0') { if (plus) {ans += most_right_zero - (i + 1);} else {ans -= most_right_zero - (i + 1);} plus = !plus; } } cout << ans << endl; }