#include <bits/stdc++.h>
using namespace std;

typedef long long LL;

int main() {
    // freopen("in.txt", "r", stdin);
    ios::sync_with_stdio(0);
    cin.tie(0);

    string s;
    cin >> s;
    LL zeros = 0, pos = 0, ones = 0;
    LL blocks = 0;
    LL bad = 0;
    for(int i = 0; i < s.size(); i++) {
        if(s[i] == '0') {
            zeros++;
            pos++;
            continue;
        }
        LL l = i, r = i;
        for(int j = i+1; j < s.size(); j++) {
            if(s[j] == '0') break;
            r = j;
        }
        LL gap = r-l+1;
        blocks += gap/2;
        if(gap & 1) {
            pos++;
            ones++;
            if(pos & 1) bad += zeros/2;
            else bad += (zeros+1)/2;
        }
        i = r;
    }
    LL ans = blocks * zeros + ones * zeros - bad;
    ones += 2 * blocks;
    while(ones > 0) {
        ans += (ones+1)/2;
        ones--;
    }
    cout << ans << endl;
    return 0;
}

