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
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author aajisaka
 */

#include<bits/stdc++.h>

using namespace std;

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define SPEED ios_base::sync_with_stdio(false);cin.tie(nullptr)
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
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; }

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;

constexpr long double PI = 3.14159265358979323846264338327950288L;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

class EBinaryProgramming {
public:
    void solve(istream& cin, ostream& cout) {
      SPEED;

      string t; cin >> t;
      int n = t.size();
      vector<int> zero(1);
      vector<int> one;
      ll dup = 0;
      ll sumzero = 0;
      rep(i, n) {
        if (t[i] == '0') {
          zero.back()++;
          sumzero++;
        } else {
          if (zero.size() == 1 || zero.back() != 0) {
            zero.push_back(0);
            one.push_back(i);
          } else {
            zero.pop_back();
            one.pop_back();
            dup++;
          }
        }
      }
      ll x = dup*(sumzero+1);

      ll L = 0;
      int zs = zero.size();
      debug(zs);
      rep(i, zs-1) {
        L += zero[i];
        ll R = sumzero - L;

        if (one[i]%2 == 0) {
          x += (L+2)/2;
        } else {
          x += (L+1)/2;
        }
        x += R;
      }
      debug(x);

      ll onecnt = n - sumzero - 1;
      ll d = (onecnt+1)/2;
      x += d*(d+1);
      if (onecnt%2==1) {
        x -= d;
      }
      debug(x);
      cout << x << endl;

    }
};

signed main() {
  EBinaryProgramming solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}