The bear has a string s = s1s2... s|s| (record |s| is the string's length), consisting of lowercase English letters. The bear wants to count the number of such pairs of indices i, j (1 ≤ i ≤ j ≤ |s|), that string x(i, j) = sisi + 1... sj contains at least one string "bear" as a substring.

String x(i, j) contains string "bear", if there is such index k (i ≤ k ≤ j - 3), that sk = b, sk + 1 = e, sk + 2 = a, sk + 3 = r.

Help the bear cope with the given problem.

Input

The first line contains a non-empty string s (1 ≤ |s| ≤ 5000). It is guaranteed that the string only consists of lowercase English letters.

Output

Print a single number — the answer to the problem.

Examples

Input

bearbtear


Output

6


Input

bearaabearc


Output

20

Note

In the first sample, the following pairs (i, j) match: (1, 4), (1, 5), (1, 6), (1, 7), (1, 8), (1, 9).

In the second sample, the following pairs (i, j) match: (1, 4), (1, 5), (1, 6), (1, 7), (1, 8), (1, 9), (1, 10), (1, 11), (2, 10), (2, 11), (3, 10), (3, 11), (4, 10), (4, 11), (5, 10), (5, 11), (6, 10), (6, 11), (7, 10), (7, 11).
import java.io.BufferedReader;
import java.io.*;
import java.math.BigInteger;
import java.text.DecimalFormat;
import java.util.*;


/**
 * Author: Luis Manuel Díaz Barón
 * Problem: 2430 - Triangular Numbers
 * Online Judge: The key here is to find sqrt(8*N + 1) with a numeric method
 * Idea:
 *
 */


public class Main {

    static MyScanner sc;
    static MyWriter mw;
    static String filePath="d:\\lmo.in";

    public static void main(String[] args) throws IOException {
        sc = new MyScanner(System.in);
       // sc = new MyScanner(new FileReader(filePath));
        mw = new MyWriter(System.out);

        //int tc=sc.nextInt();
        while(sc.canRead())
            SolveSingleProblem();

        mw.close();
    }
    static int arr[];
    public static void SolveSingleProblem() throws IOException{
        String s = sc.next();
        long cnt = 0;
        int last = -1;
        for (int i = 0; i < s.length() - 3; i++) {
            char fi = s.charAt(i);
            char sec = s.charAt(i + 1);
            char th = s.charAt(i  +2);
            char ff = s.charAt(i+3);

            if(fi == 'b' && sec == 'e' && th == 'a' && ff == 'r'){

                if(i + 3 == s.length() - 1)
                    cnt += (i - last );

                else cnt += (i - last ) * (s.length() - (i + 3));

                last = i;
            }



        }

        mw.println(cnt);
    }

    static double Distance(int XF, int YF, int XS, int YS){

        int DX = XF - XS;
        int DY = YF - YF;
        return Math.sqrt( (DX* DX) +  (DY * DY) );
    }

    static int MOD = 1000003;
    static long  squares(int c){
        if(c==0) return 1;

        return (  (4 * squares(c - 1) ) % MOD  + 1 ) % MOD;
    }




}



class Circumference{
    public int R, X, Y;
    public Circumference(int R,int X,int Y){
        this.R = R; this.X = X; this.Y = Y;
    }
}


class MyScanner{
    BufferedReader br;
    StringTokenizer stk;
    public MyScanner(InputStream stream){
        this.br = new BufferedReader(new InputStreamReader(stream),72357);
        this.stk = new StringTokenizer("");
    }

    public MyScanner(FileReader fr){
        this.br = new BufferedReader(fr);
        this.stk = new StringTokenizer("");
    }

    public String next() throws IOException {
        while(!stk.hasMoreElements()){
            String line = br.readLine();
            if(line == null)
                return null;
            stk = new StringTokenizer(line);
        }
        return stk.nextToken();
    }

    public int nextInt()throws IOException{
        return Integer.parseInt(next());
    }

    public long nextLong() throws IOException{
        return Long.parseLong(next());
    }

    public double nextDouble() throws IOException{
        return Double.parseDouble(next());
    }

    public boolean canRead() throws IOException{
        return br.ready();
    }

    public int [] nextIntArray(int n) throws IOException{
        int arr[] = new int[n];
        for(int i=0;i<n;i++)
            arr[i] = nextInt();
        return arr;
    }

    public BigInteger nextBigInteger() throws IOException{
        return new BigInteger(this.next());
    }
}

class MyWriter{

    PrintWriter pw;
    public MyWriter(OutputStream out){
        this.pw = new PrintWriter(out);
    }

    public void print(Object obj){
        pw.print(obj.toString());
    }

    public void println(Object obj){
        pw.println(obj.toString());
    }

    public void printArray(int[] arr){
        for(int i=0;i<arr.length;i++){

            if(i==0)
                println(arr[i]);
            else println(" "+arr[i]);

        }
    }


    public void printVector(Vector<Integer> arr){
        for(int i=0;i<arr.size();i++){

            if(i==0)
                print(arr.elementAt(i));
            else print(" " + arr.elementAt(i));

        }
    }

    public void printIntMatrix(int [][] mt){
        for(int i=0;i<mt.length;i++){
            for(int j=0;j<mt[0].length;j++){
                print(mt[i][j]+" ");
            }
            println("");
        }
        println("");
    }
    public void close() {
        pw.close();
    }

}