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;
const int INF = (int)(1e9 + 1337);
const long long LINF = (long long)(4e18);
const double EPS = (double)(1e-7);
int n;
int a[300010];
int d[300010];
long long do_solve() {
  int lid = -1;
  for (int i = 0; i < n; ++i) {
    d[i] = -1;
    for (int j = 1; i + 2 * j < n; ++j) {
      if (a[i] == a[i + j] && a[i] == a[i + 2 * j]) {
        d[i] = i + 2 * j;
        lid = i;
        break;
      }
    }
  }
  if (lid < 0) {
    return 0;
  }
  long long cur = d[lid];
  long long ans = n - cur;
  for (int i = lid - 1; i >= 0; --i) {
    if (d[i] != -1) {
      cur = min(cur, (long long)d[i]);
    }
    ans += n - cur;
  }
  return ans;
}
void solve() {
  string s;
  cin >> s;
  n = s.size();
  for (int i = 0; i < n; ++i) {
    a[i] = s[i] - '0';
  }
  cout << do_solve();
}
void stress() {
  n = 300000;
  mt19937 gen(1337);
  uniform_int_distribution<int> distr(0, 1);
  for (int i = 0; i < n; ++i) {
    a[i] = distr(gen);
  }
  cout << do_solve();
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  solve();
  return 0;
}