#include <bits/stdc++.h>

using namespace std;
using int64 = long long;

constexpr int DEBUG = 0;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);

  string s;
  cin >> s;
  string t = regex_replace(s, regex("11"), "XX");
  string u = regex_replace(t, regex("0"), "");
  if (DEBUG) {
    cout << "t: " << t << endl;
    cout << "u: " << u << endl;
  }

  int64 ans = 0;
  for (int i = 0; i < u.length(); i++) {
    ans += (i + 2) / 2;
  }

  int x_count = 0;
  for (char c : u) {
    if (c == 'X') {
      x_count++;
    }
  }

  ans += (x_count / 2) * (s.length() - u.length());

  vector<int> p1s;
  vector<int> p2s;
  for (int i = 0; i < t.length(); i++) {
    if (t[i] == '1') {
      p1s.push_back(i);
    }
  }
  for (int i =0; i < u.length(); i++) {
    if (u[i] == '1') {
      p2s.push_back(i);
    }
  }

  if (DEBUG) {
    cout << "ans: " << ans << endl;
  }
  for (int i = 0; i < p1s.size(); i++) {
    int p1 = p1s[i];
    int p2 = p2s[i];
    ans += (s.length() - u.length()) - ((p1 + 1) / 2 - (p2 + 1) / 2);
  }
  cout << ans << endl;
}