Takahashi has an empty string S and a variable x whose initial value is 0.

Also, we have a string T consisting of `0` and `1`.

Now, Takahashi will do the operation with the following two steps |T| times.

* Insert a `0` or a `1` at any position of S of his choice.
* Then, increment x by the sum of the digits in the odd positions (first, third, fifth, ...) of S. For example, if S is `01101`, the digits in the odd positions are `0`, `1`, `1` from left to right, so x is incremented by 2.



Print the maximum possible final value of x in a sequence of operations such that S equals T in the end.

Constraints

* 1 \leq |T| \leq 2 \times 10^5
* T consists of `0` and `1`.

Input

Input is given from Standard Input in the following format:


T


Output

Print the maximum possible final value of x in a sequence of operations such that S equals T in the end.

Examples

Input

1101


Output

5


Input

0111101101


Output

26
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define mp make_pair
#define PI pair<int,int>
#define poly vector<ll>
#define mem(a) memset((a),0,sizeof(a))
#define For(i,l,r) for(int i=(int)(l);i<=(int)(r);i++)
#define Rep(i,r,l) for(int i=(int)(r);i>=(int)(l);i--)
#define pb push_back
#define fi first
#define se second
#define SZ(x) ((int)(x.size()))
inline char gc(){
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}
#define gc getchar
inline ll read(){
	ll x = 0; char ch = gc(); bool positive = 1;
	for (; !isdigit(ch); ch = gc())	if (ch == '-')	positive = 0;
	for (; isdigit(ch); ch = gc())	x = x * 10 + ch - '0';
	return positive ? x : -x;
}
inline void write(ll a){
    if(a<0){
    	a=-a; putchar('-');
	}
    if(a>=10)write(a/10);
    putchar('0'+a%10);
}
inline void writeln(ll a){write(a); puts("");}
inline void wri(ll a){write(a); putchar(' ');}
ll rnd(){
	ull ans=0;
	For(i,0,4)ans=ans<<15^rand();
	return ans%((ull)1<<63);
}
const int N=200005,M=1<<19|2,inf=1e9+7;
int sum[M][2],lzy[M];
PI tr[M][2];
char ch[N];
PI operator +(PI a,int b){
	a.fi+=b;
	return a;
}
void push_up(int nod){
	For(i,0,1){
		sum[nod][i]=sum[nod<<1][i]+sum[nod<<1|1][i];
		tr[nod][i]=max(tr[nod<<1|1][i],tr[nod<<1][i]+sum[nod<<1|1][i]);
	}
	if(lzy[nod]){
		swap(sum[nod][0],sum[nod][1]);
		swap(tr[nod][0],tr[nod][1]); 
	}
}
void cao(int nod){
	lzy[nod]^=1;
	swap(sum[nod][0],sum[nod][1]);
	swap(tr[nod][0],tr[nod][1]); 
}
void ins(int l,int r,int i,int nod){
	if(i<=l){
		cao(nod); return;
	}
	int mid=(l+r)>>1;
	if(i<=mid)ins(l,mid,i,nod<<1);
	ins(mid+1,r,i,nod<<1|1);
	push_up(nod);
}
void Ins(int l,int r,int i,int nod){
	if(l==r){
		tr[nod][0].fi=tr[nod][1].fi=-inf; return;
	}
	int mid=(l+r)>>1;
	if(i<=mid)Ins(l,mid,i,nod<<1);
	else Ins(mid+1,r,i,nod<<1|1);
	push_up(nod);
}
void build(int l,int r,int nod){
	if(l==r){
		For(i,0,1)if(ch[l]){
			tr[nod][i].fi=-inf; sum[nod][i]=(l%2^i)?-1:1;
		}else tr[nod][i].se=l;
		return;
	}
	int mid=(l+r)>>1;
	build(l,mid,nod<<1); build(mid+1,r,nod<<1|1);
	push_up(nod);
}
ll mx,mn;
int main(){
	#ifdef Brollan
		freopen("1.in","r",stdin);
	#endif
	scanf("%s",ch+1);
	int n=strlen(ch+1),cnt=0,c1=0,c2=0;
	Rep(i,n,1){
		ch[i]-='0';
		swap(c1,c2);
		if(ch[i]==1){
			swap(mn,mx);
			mx+=cnt+1; c1++; 
		}else{
			ll mmx=max(c1+mx,mn+(c1+c2+1)/2);
			ll mmn=max(c2+mn,mx+(c1+c2)/2);
			mx=mmx; mn=mmn;
			cnt++;
		}
		//cout<<mn<<" "<<mx<<" "<<c1<<" "<<c2<<endl;
	}
	Rep(i,n-cnt-1,1)mx+=(i+1)/2;
	cout<<mx<<endl;
}
/*
010101

*/