#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
#define N 200020
typedef long long ll;
inline int read(){
	int x=0,f=1;
	char c=getchar();
	while(c<'0'||c>'9'){
		if(c=='-')f=-1;
		c=getchar();
	}
	while(c>='0'&&c<='9'){
		x=(x<<1)+(x<<3)+c-'0';
		c=getchar();
	}
	return x*f;
}
char s[N];
int n,c0,c1,now;
ll ans;
int main(){
	scanf("%s",s+1);
	n=strlen(s+1);
	for(int i=1;i<=n;++i){
		if(s[i]=='0')++c0;
		else ++c1;
	}
	for(int i=1;i<=c1;++i){
		ans+=(i+1)>>1;
	}
	for(int i=1;i<=n;++i){
		if(s[i]=='0'){
			++now;
		}
		else if(s[i]==s[i+1]){
			++i,ans+=c0;
		}
		else{
			ans+=c0-now+(i&1?(now+1)/2:now/2);
		}
	}
	printf("%lld\n",ans);
	return 0;
}
