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
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
using ll = long long;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007;
// const int MOD = 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
const int dy8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dx8[] = {0, -1, -1, -1, 0, 1, 1, 1};
template <typename T, typename U> inline bool chmax(T &a, U b) { return a < b ? (a = b, true) : false; }
template <typename T, typename U> inline bool chmin(T &a, U b) { return a > b ? (a = b, true) : false; }
struct IOSetup {
  IOSetup() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  }
} iosetup;

int main() {
  string t; cin >> t;
  int n = t.length();
  int l_even = 0, l_odd = 0, r_even = 0, r_odd = 0;
  REP(i, n) {
    if (t[i] == '1') (i % 2 == 0 ? r_even : r_odd) += 1;
  }
  ll ans = 0;
  int pos = 0;
  string s = "";
  REP(i, n) {
    if (t[i] == '0') {
      if (pos % 2 == 0) {
        ans += l_even + r_even;
        swap(r_even, r_odd);
      } else {
        s += t[i];
        ++pos;
      }
    } else if (t[i] == '1') {
      if (pos % 2 == 0) {
        --r_even;
        ++l_even;
      } else {
        --r_odd;
        ++l_odd;
      }
      s += t[i];
      ++pos;
    }
  }
  // cout << ans << ' ' << s << '\n';
  for (int i = int(s.length()) - 1; i >= 0; --i) {
    if (s[i] == '0') {
      ans += l_even + r_even;
      swap(r_even, r_odd);
    } else if (s[i] == '1') {
      if (i % 2 == 0) {
        --l_even;
        ++r_even;
      } else {
        --l_odd;
        ++r_odd;
      }
    }
  }
  // cout << ans << '\n';
  for (int len = r_even + r_odd; len >= 1; --len) ans += (len + 1) / 2;
  cout << ans << '\n';
  return 0;
}
