Problem: Toad Rash has a binary string s. A binary string consists only of zeros and ones.

Let n be the length of s.

Rash needs to find the number of such pairs of integers l, r that 1 ≤ l ≤ r ≤ n and there is at least one pair of integers x, k such that 1 ≤ x, k ≤ n, l ≤ x < x + 2k ≤ r, and s_x = s_{x+k} = s_{x+2k}.

Find this number of pairs for Rash.

Input

The first line contains the string s (1 ≤ |s| ≤ 300 000), consisting of zeros and ones.

Output

Output one integer: the number of such pairs of integers l, r that 1 ≤ l ≤ r ≤ n and there is at least one pair of integers x, k such that 1 ≤ x, k ≤ n, l ≤ x < x + 2k ≤ r, and s_x = s_{x+k} = s_{x+2k}.

Examples

Input


010101


Output


3


Input


11001100


Output


0

Note

In the first example, there are three l, r pairs we need to count: 1, 6; 2, 6; and 1, 5.

In the second example, there are no values x, k for the initial string, so the answer is 0.

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
inline long long mod(long long n, long long m) {
  long long ret = n % m;
  if (ret < 0) ret += m;
  return ret;
}
long long gcd(long long a, long long b) { return (b == 0 ? a : gcd(b, a % b)); }
long long exp(long long a, long long b, long long m) {
  if (b == 0LL) return 1LL;
  if (b == 1LL) return mod(a, m);
  long long k = mod(exp(a, b / 2, m), m);
  if (b & 1LL) {
    return mod(a * mod(k * k, m), m);
  } else
    return mod(k * k, m);
}
const long long MAXN = 300100;
vector<pair<long long, long long> > in;
long long mark[MAXN];
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  string s;
  cin >> s;
  long long n = s.size();
  for (long long i = 0; i < n; i++) {
    for (long long k = 1; k <= n; k++) {
      if (i - k < 0 or i + k >= n) break;
      if (i - k >= 0 && i + k < n && s[i] == s[i - k] && s[i] == s[i + k]) {
        in.push_back(pair<long long, long long>(i - k, i + k));
        break;
      }
    }
  }
  long long tot = 0;
  sort(in.begin(), in.end());
  vector<pair<long long, long long> > v = in;
  in.clear();
  set<pair<long long, long long> > S;
  long long last = -1;
  for (long long i = 0; i < v.size(); i++) {
    long long l = v[i].first, r = v[i].second;
    if (l == last) {
      mark[i] = 1;
      continue;
    }
    while (!S.empty()) {
      set<pair<long long, long long> >::iterator it =
          S.lower_bound(pair<long long, long long>(r, -1000));
      if (it != S.end()) {
        mark[it->second] = 1;
        S.erase(it);
        continue;
      } else
        break;
    }
    S.insert(pair<long long, long long>(r, i));
  }
  for (long long i = 0; i < v.size(); i++) {
    if (!mark[i]) in.push_back(v[i]);
  }
  last = -1;
  long long lastr = -1;
  for (long long i = 0; i < in.size(); i++) {
    long long l = in[i].first;
    long long r = in[i].second;
    if (l == last) continue;
    tot += (l - last) * (n - r);
    if (lastr != -1 && lastr > r) tot += 1LL * (lastr - r);
    last = l;
    lastr = r;
  }
  cout << tot << "\n";
}