#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
using namespace std;
#define MOD @
#define ADD(X,Y) ((X) = ((X) + (Y)%MOD) % MOD)
typedef long long i64; typedef vector<int> ivec; typedef vector<string> svec;

char T[202020];
int N;

map<string, int> memo;

i64 solve(string S)
{
	if (S.size() == 0) return 0;
	if (memo.count(S)) return memo[S];
	i64 ret = 0;
	for (int i = 0; i < S.size(); ++i) {
		string T = S;
		T.erase(T.begin() + i);
		ret = max(ret, solve(T));
	}
	for (int i = 0; i < S.size(); i += 2) if (S[i] == '1') ++ret;
	return memo[S] = ret;
}

void solve2(string S)
{
	if (S.size() == 0) return;
	i64 expected = solve(S);
	for (int i = 0; i < S.size(); i += 2) if (S[i] == '1') --expected;

	pair<int, int> gain{-1000, -1};
	for (int i = 0; i < S.size(); ++i) if (S[i] == '0') {
		int g = 0;
		for (int j = i + 1; j < S.size(); ++j) if (S[j] == '1') {
			if (j % 2 == 0) --g;
			else ++g;
		}
		gain = max(gain, {g, i});
	}
	if (gain.second != -1) {
		string T = S;
		T.erase(T.begin() + gain.second);
		if (solve(T) != expected) printf("sad %d %d\n", gain.first, gain.second);
	}
	for (int i = 0; i < S.size(); ++i) {
		if (S[i] == '1') continue;
		string T = S;
		T.erase(T.begin() + i);
		if (solve(T) == expected) {
			printf("%s ['0' %d]\n", S.c_str(), i);
			solve2(T);
			return;
		}
	}
	for (int i = 0; i < S.size(); ++i) {
		if (S[i] == '0') continue;
		string T = S;
		T.erase(T.begin() + i);
		if (solve(T) == expected) {
			printf("%s ['1' %d]\n", S.c_str(), i);
			solve2(T);
			return;
		}
	}
}
int main()
{
	scanf("%s", T);
	N = strlen(T);
	int zall = 0;
	for (int i = 0; i < N; ++i) if (T[i] == '0') ++zall;

	int n_zeros = 0;
	i64 ret = 0;
	for (int i = 0; i < N; ++i) {
		if (T[i] == '1' && T[i + 1] == '1') {
			ret += zall;
			i += 1;
			continue;
		}
		if (T[i] == '1') {
			ret += zall - (n_zeros + (i % 2)) / 2;
		} else {
			++n_zeros;
		}
	}
	int n_ones = N - zall;
	while (n_ones) {
		ret += (n_ones + 1) / 2;
		--n_ones;
	}
	printf("%lld\n", ret);
	return 0;
	printf("%d\n", solve(string(T)));
	solve2(T);
	return 0;
}
