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 dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
int Read() {
  char c;
  c = getchar();
  int tsqua = 0;
  while (c != ' ' && c != '\n') {
    tsqua = (((tsqua << 1) << 1) << 1) + (tsqua << 1) + (int)(c - '0');
    c = getchar();
  }
  return tsqua;
}
char s[300010];
int n;
inline bool chk(int L, int R) {
  for (register int len = 1; len * 2 <= R - L + 1; len++)
    for (register int i = L; i + len * 2 <= R; i++)
      if (s[i] == s[i + len] && s[i + len] == s[i + len + len]) return 1;
  return 0;
}
inline long long GetAns(int L, int R) {
  if (L > R) return 0ll;
  long long ret = 0ll;
  if (R - L + 1 <= 10) {
    for (register int i = L; i <= R; i++)
      for (register int j = L + 1; j <= R; j++) ret += chk(i, j);
    return ret;
  }
  for (register int i = L; i <= R; i++)
    if (chk(L, i)) {
      int pos = L;
      for (; pos <= i; pos++)
        if (!chk(pos, i)) break;
      return GetAns(pos, R) + (long long)(R - i + 1) * (pos - L);
    }
}
int main(int argc, char const *argv[]) {
  ios::sync_with_stdio(false);
  scanf("%s", s + 1);
  n = strlen(s + 1);
  cout << GetAns(1, n);
  return 0;
}