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;
template <typename T1, typename T2>
inline void chmin(T1& a, T2 b) {
  if (a > b) a = b;
}
template <typename T1, typename T2>
inline void chmax(T1& a, T2 b) {
  if (a < b) a = b;
}
long long MOD = 998244353;
const long long MAX = 200060;
const long double pi = acos(-1);
const long double EPS = 1e-12;
void solve() {
  string S;
  cin >> S;
  long long N = S.size();
  vector<long long> zero, one;
  for (long long i = 0; i < N; i++) {
    if (S[i] == '0')
      zero.push_back(i);
    else
      one.push_back(i);
  }
  vector<pair<long long, long long> > v;
  long long M0 = zero.size();
  for (long long l = 0; l < M0 - 2; l++) {
    for (long long mid = l + 1; mid < M0 - 1; mid++) {
      long long d = zero[mid] - zero[l];
      if (zero[mid] + d > zero[M0 - 1]) break;
      if (S[zero[mid] + d] == '0') {
        v.push_back({zero[mid] + d, zero[l]});
        break;
      }
    }
  }
  long long M1 = one.size();
  for (long long l = 0; l < M1 - 2; l++) {
    for (long long mid = l + 1; mid < M1 - 1; mid++) {
      long long d = one[mid] - one[l];
      if (one[mid] + d > one[M1 - 1]) break;
      if (S[one[mid] + d] == '1') {
        v.push_back({one[mid] + d, one[l]});
        break;
      }
    }
  }
  sort(v.begin(), v.end());
  ;
  long long ans = 0;
  long long idx = 0;
  long long M = v.size();
  if (M == 0) {
    cout << 0 << '\n';
    return;
  }
  for (long long l = 0; l < N - 2; l++) {
    while (l > v[idx].second) {
      idx++;
      if (idx >= M) {
        goto END;
      }
    }
    ans += N - v[idx].first;
  }
END:;
  cout << ans << '\n';
}
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  solve();
}