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 vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef pair<LL, LL> PLL;
typedef vector<PLL> VPLL;
typedef priority_queue<int> PQ_DESC;
typedef priority_queue<int, vector<int>, greater<int>> PQ_ASC;
typedef priority_queue<PII> PQ_DESC_PII;
typedef priority_queue<PII, vector<PII>, greater<PII>> PQ_ASC_PII;

#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define MP make_pair
#define SORT_ASC(c) sort(ALL(c))
//#define SORT_DESC(c) sort(ALL(c), greater<typeof(*((c).begin()))>())
#define SORT_DESC(c) sort((c).rbegin(),(c).rend())
#define REV(c) reverse((c).begin(), (c).end())
#define SIZE(a) int((a).size())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ROF(i,a,b) for(int i=(b-1);i>=(a);--i)
#define REP(i,n) FOR(i,0,n)
#define PER(i,n) ROF(i,0,n)

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int LARGE_INT = 1e9+100;
const int INF = 2e9+100;
const LL INF_LL = (LL)INF*(LL)INF;
const int MOD = 1e9+7;

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

LL modpow(LL a, LL n) {
    LL res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

void Main()
{
    string t;cin>>t;
    int n=SIZE(t);

    int c1=0;
    int c0=0;
    int len=0;
    VI podd;
    VI peven;
    LL result=0;
    REP(i,n){
        if(t[i] == '0'){
            c0++;
            if(len%2==0){
                peven.PB(i);
            }
            else{
                len++;
                result+=(len+1)/2;
                podd.PB(i);
            }
        }
        else{
            c1++;
            len++;
            result+=(len+1)/2;
        }
    }

    int zm=0;
    int zz=0;



    PER(i,SIZE(peven)){
        len++;
        int change = SIZE(peven)-i-1;
        auto itr = upper_bound(ALL(podd),peven[i]);
        change += podd.end()-itr;
        //dump(i)
        //dump(peven[i])
        //dump(change)
        //dump(zm)
        //dump(zz)

        int a = zm+zz-change;
        int zza = zz-a;
        swap(zza,zm);
        zz = a+zza;
        
        //dump(zm)
        //dump(zz)

        int b = n-peven[i];
        if(len%2 == 0){
            if(b%2 == 0){
                zm++;
            }
            else{
                zz++;
            }
        }
        else{
            if(b%2 == 0){
                zz++;
            }
            else{
                zm++;
            }
        }
        //dump(zm)
        //dump(zz)

        result+=(len+1)/2-zm;

    }

    std::cout<<result<<endl;




}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	std::cout << fixed << setprecision(15);
	Main();
    return 0;
}