#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
#define rep(i, n) for(ll i = 0; i < (ll)n; i++)

int main() {
    string t;
    cin >> t;
    ll n = (long long)t.length();

    vector<pair<int, ll>> bag;
    char dig = t[0];
    ll strk = 1;
    for(int i = 1; i < n; i++) {
        if(t[i] != dig) {
            if(dig == '1') bag.push_back({1, strk});
            else bag.push_back({0, strk});
            dig = t[i];
            strk = 1;
        } else strk++;
    }
    if(dig == '1') bag.push_back({1, strk});
    else bag.push_back({0, strk});

    ll sum1 = 0, sum0 = 0;
    rep(i, n) {
        if(t[i] == '1') sum1++;
        else sum0++;
    }

    ll ans = 0;
    rep(i, n) if(i % 2 == 0 && t[i] == '1') ans++;
    ll tmp1 = 0, tmp0 = 0;
    for(auto elm: bag) {
        if(elm.first == 1) {
            ans += sum0 * (elm.second / 2);
            if(elm.second % 2) {
                if((tmp1 + tmp0) % 2) ans += (tmp0 + 1) / 2;
                else ans += tmp0 / 2;
                ans += sum0 - tmp0;
            }
            tmp1 += elm.second;
        } else tmp0 += elm.second;
    }

    rep(i, sum1) ans += (i + 1) / 2;

    cout << ans << endl;
    return 0;
}
