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>
#define For(i,x,y) for (register int i=(x);i<=(y);i++)
#define FOR(i,x,y) for (register int i=(x);i<(y);i++)
#define Dow(i,x,y) for (register int i=(x);i>=(y);i--)
#define Debug(v) for (auto i:v) printf("%lld ",i);puts("")
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define ep emplace_back
#define siz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define fil(a,b) memset((a),(b),sizeof(a))
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pa;
typedef pair<ll,ll> PA;
typedef vector<int> poly;
inline ll read(){
    ll x=0,f=1;char c=getchar();
    while ((c<'0'||c>'9')&&(c!='-')) c=getchar();
    if (c=='-') f=-1,c=getchar();
    while (c>='0'&&c<='9') x=x*10+c-'0',c=getchar();
    return x*f;
}

const int N = 2e5+10;
int n,a[N],nxt[N],suf[N];
char s[N];
ll ans;

int main(){
	scanf("%s",s+1),n=strlen(s+1);
	int cnt=0;
	For(i,1,n) if (s[i]=='1') ++cnt,ans+=(cnt+1)/2;
	int now=cnt+1;
	Dow(i,n,1) 
		if (s[i]=='0') a[now]++;
			else --now;
	Dow(i,cnt,1){
		suf[i]=suf[i+1]+(i&1);
		if (a[i+1]||i==cnt) nxt[i]=i+1;
			else nxt[i]=nxt[i+1];
	}
	int pre=0;
	For(i,1,cnt) if (a[i]||i==1){
		pre+=a[i],ans+=1ll*(nxt[i]-i)*(pre/2);
		if (pre&1) ans+=(nxt[i]-i)-(suf[i]-suf[nxt[i]]);
		if (a[i]) ans+=1ll*(n-cnt-pre)*max(suf[i]-suf[nxt[i]],(nxt[i]-i)-(suf[i]-suf[nxt[i]]));
			else ans+=1ll*(n-cnt)*(suf[i]-suf[nxt[i]]);
	}
	printf("%lld\n",ans);
}
/*
010101
*/