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 long double ld;
#define REP(i,n) for(ll i = 0; i<(ll)(n); i++)
#define REPS(i,n) for (ll i = 1; i<=(ll)(n); i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define pb push_back
#define MOD 1000000007
#define MOD2 998244353
#define PI 3.141592653
#define INF 100000000000000 //14

int main(){
	string s; cin >> s; string t=""; ll cntl = 0; ll cnto = 0; ll cnter = 0;
	REP(i,s.size()){
		if (i==0&&s[i]=='1') cnter++;
		else if (i==0&&s[i]=='0') t+='0';
		else if (i!=s.size()-1&&s[i]=='1') cnter++;
		else if (s[i-1]=='0'&&s[i]=='0') t+='0';
		else{
			if (i==s.size()-1&&s[i]=='1') cnter++;
			cntl+=(cnter/2)*2; cnto+=cnter;
			if (cnter%2) t+='1';
			if (s[i]!='1') t+='0';
			cnter = 0;
		}
	}
	ll x = cnto/2;
	ll ans =(s.size()-cnto+1)*cntl/2;
	if (cnto%2) ans+=x*x+x;
	else ans+=x*x;
	cnter=1;
	ll cnter2=0;
	REP(i,t.size()){
		if (t[i]=='1'){
			ans+=(i+1-cnter)/2+1;
			cnter+=2;
			cnter2++;
		}
		if (i!=t.size()-1&&t[i]=='0'&&t[i+1]=='0') ans+=cnter2;
		if (i==t.size()-1&&t[i]=='0') ans+=cnter2;
	}
	ll z = (cnter-1)/2;
	FOR(i,1,z-1) ans+=(i+(z-i)/2);
	if(s=="1") ans++;
	cout << ans << endl;
}