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

int main(){
  string T; cin >> T;
  int N = T.size();
  vector<bool> A(N);
  rep(i, N) A[i] = (T[i] == '1');

  vector<vector<int>> r(2, vector<int>(N + 1, 0));
  for (int i = N - 1; i >= 0; i--) {
    r[0][i] = r[0][i + 1];
    r[1][i] = r[1][i + 1];
    if (A[i]) r[i % 2][i]++;
  }

  int now = 0, t = N, s = 0, p = 0;
  long long ans = r[0][0];
  bool check = false;
  while (t > 0) {
    if (check) {
      ans += t / 2;
      t--;
    } else {
      for (; now < N; now++) {
        if (now % 2 == p) {
          if (A[now]) s++;
          else break;
        }
      }
      if (now >= N) {
        check = true;
        continue;
      }
      now++;
      t--;
      p ^= 1;
      ans += s + r[p][now];
    }
  }

  cout << ans << endl;
}

