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>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,tune=native")
#pragma GCC optimize("fast-math")
using namespace std;
const long long inf = 1e17;
mt19937 random1(16783849);
long long randlr(long long l, long long r) {
  return random1() % (r - l + 1) + l;
}
struct Point {
  long long first, second;
  Point(){};
  Point(long long _x, long long _y) {
    first = _x;
    second = _y;
  }
};
struct Vector {
  long long first, second;
  Vector(){};
  Vector(Point p) {
    first = p.first;
    second = p.second;
  }
  Vector(Point p1, Point p2) {
    first = p2.first - p1.first;
    second = p2.second - p1.second;
  }
  long long operator*(Vector &oth) {
    return first * oth.second - second * oth.first;
  }
};
bool in_ang(Point p, Point a, Point o, Point b) {
  Vector oa(o, a), ob(o, b), op(o, p);
  return (oa * op > 0 && op * ob > 0) || (oa * op < 0 && op * ob < 0);
}
signed main() {
  ios ::sync_with_stdio(0);
  cin.tie(0);
  map<string, bool> isok;
  for (long long len = 1; len <= 8; len++) {
    for (long long mask = 0; mask < (1 << len); mask++) {
      string s = "";
      for (long long j = 0; j < len; j++) {
        if ((mask >> j) & 1) {
          s += '1';
        } else {
          s += '0';
        }
      }
      bool ok = 0;
      for (long long first = 0; first < len - 2; first++) {
        for (long long k = 1; first + 2 * k < len; k++) {
          if (s[first] == s[first + k] && s[first + k] == s[first + 2 * k]) {
            ok = 1;
          }
        }
      }
      isok[s] = ok;
    }
  }
  long long answ = 0;
  long long n;
  string s;
  cin >> s;
  n = s.size();
  for (long long i = 0; i < n; i++) {
    string curr = "";
    for (long long j = i; j < min(n, i + 8); j++) {
      curr += s[j];
      answ += isok[curr];
    }
    if (i + 8 < n) {
      answ += n - (i + 8);
    }
  }
  cout << answ;
  return 0;
}