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:
import javafx.util.Pair;

import java.io.*;
import java.lang.reflect.Array;
import java.nio.channels.InterruptedByTimeoutException;
import java.util.*;
import java.io.IOException;
import java.io.InputStream;

public class anime {
    public static void main(String[] args) throws IOException {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        int t = 1;
        for(int i = 0; i < t; i++) {
            solver.solve(in, out);
        }
        out.close();
    }
    
    
    
    static class Task {
        public void solve(InputReader in, PrintWriter out) throws IOException {
            String s = in.next();
            long ans = 0;
            int r = 0;
            for (int i  = 0; i < s.length(); i++) {
                while (r < s.length() && !good(s, i, r)) {
                    r++;
                }
                ans += s.length() - r;
            }
            out.print(ans);

        }
        boolean good (String t, int l, int r) {
            for (int i = r - 2; i >= l; i -= 2) {
                int md = (r + i) / 2;
                if (t.charAt(md) == t.charAt(r) && t.charAt(md) == t.charAt(i)) {
                    return true;
                }
            } 
            return false;
        }
        
        private int gcd(int a, int b) {
            while (b > 0) {
                int t = a % b;
                a = b;
                b = t;
            }
            return a;
        }
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }
        public int nxt() {
            return Integer.parseInt(next());
        }
        public long nxtLong() {
            return Long.parseLong(next());
        }
    }

    static class pll implements Comparable<pll> {
        public long first;
        public long second;

        public static pll makePair(long first, long second) {
            return new pll(first, second);
        }

        public pll(long first, long second) {
            this.first = first;
            this.second = second;
        }

        public int equals(pll o) {
            if(o.first > this.first) return -1;
            if(o.first < this.first) return 1;
            if(o.first == this.first && o.second > this.second) return -1;
            if(o.first == this.first && o.second < this.second) return 1;
            return 0;
        }

        public int compareTo(pll o) {
            int value = Long.compare(first, o.first);
            if (value != 0) {
                return value;
            }
            return Long.compare(second, o.second);
        }

    }
}