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 JAVA):

Solution:
/*
If you want to aim high, aim high
Don't let that studying and grades consume you
Just live life young
******************************
If I'm the sun, you're the moon
Because when I go up, you go down
*******************************
*/
import java.util.*;
import java.io.*;
import java.math.*;

   public class x1169D2
   {
      public static void main(String omkar[]) throws Exception
      {
         //BufferedReader infile = new BufferedReader(new FileReader("cowdate.in"));
         BufferedReader infile = new BufferedReader(new InputStreamReader(System.in));  
         StringTokenizer st = new StringTokenizer(infile.readLine());
         String input = st.nextToken();
         char[] arr = input.toCharArray();
         int N = arr.length;
         if(N < 3)
         {
            System.out.println(0);
            return;
         }
         long res = 0L;
         long[] pref = new long[N];
         for(int start=0; start < N-2; start++)
         {
            int k = 1;
            while(start+2*k < N)
            {
               if(arr[start+k] == arr[start] && arr[start] == arr[start+2*k])
                  break;
               k++;
            }
            if(start+2*k < N)
               pref[start] = N-(start+2*k);
         }
         for(int i=N-3; i > 0; i--)
            pref[i-1] = Math.max(pref[i-1], pref[i]);
         for(long x: pref)
            res += x;
         System.out.println(res);
      }
   }