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 <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <climits>
#include <cmath>
#include <complex>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <iomanip>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <cstdint>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
#define MP make_pair
#define PB push_back
#define inf 1000000007
#define rep(i,n) for(int i = 0; i < (int)(n); ++i)
#define all(x) (x).begin(),(x).end()

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}
 
template<class T> inline bool chmax(T &a, T b){
    if(a<b){
        a = b;
        return true;
    }
    return false;
}

template<class T> inline bool chmin(T &a, T b){
    if(a>b){
        a = b;
        return true;
    }
    return false;
}

int main(){
    string s;
    cin >> s;
    int n = s.size();
    vector<bool> ok(n);
    ll k = 0;
    rep(i,n){
        if(s[i]=='1')k++;
    }
    ll res = 0;
    for(int i=1;i<=k;i++){
        res += (i+1)/2;
    }
    ll P = (k+1)/2;
    int id = 0;
    int cc = 0;
    rep(i,n){
        if(s[i]=='1')id++;
        if(s[i]=='0'){
            if(id%2==1){
                cc++;
                res += (k+cc+1)/2;
                id++;
                ok[i] = 1;
            }
        }
    }
    cerr << res << endl;
    int Q = (k+cc+1)/2;
    int a = 0;
    int b = 0;
    for(int i=n-1;i>=0;i--){
        if(s[i]=='1'){
            if(id%2==1){
                b++;
                Q--;
            }else{
                a++;
            }
            id--;
        }else{
            if(ok[i]){
                id--;
            }else{
                // cerr << Q << " " <<  a <<" " << b << endl;
                swap(a,b);
                res += Q+b;
            }
        }
    }
    cout << res << endl;
    return 0;
}