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.util.*;





public class Main {
    static Scanner input = new Scanner(System.in);
   
    static char[][] arr1;
    static ArrayList<ArrayList<Integer>> graph;
    static boolean[] vis;
    static int n; 
    static long m; 
    static ArrayList<Integer> lengths;
    static Stack<Integer> s = new Stack<>();
    static ArrayList<Integer> topo;
    static int count;
    static int arr[];
    static char[] charArr;
    
    public class pairIndex {
    	int i;
    	int j;
    	
    	public pairIndex(int x, int y) {
    		i = x;
    		j = y;
    	}	
    	@Override
    	public String toString() {
    		return "(" + i + ", " + j + ")";
    	}
    }  
    
    public static class Pair{
    	int x;
    	int y;
    	public Pair(int x, int y) {
    		this.x = x;
    		this.y = y;
		}
    	@Override
    	public String toString() {
    		return "(" + x + ", " + y + ")";
    	}
    }

	private static void updateLenghts(ArrayList<Integer> lengths) {
		lengths.clear();
		for (int i = 0; i < graph.size(); i++)
			lengths.add(graph.get(i).size());
	}   
    
    
    public static void readArray(int nRow, int nCol, int[][] arr) {
    	for (int i = 0; i < nRow; i++)
    		for (int j = 0; j < nCol; j++)
    			arr[i][j] = input.nextInt();
    }
    
   
    public static void StringsToCharArray(char[][] arr, int n, int m) {
    	for (int i = 0; i < n; i++) {
			String word = input.next();
			for (int j = 0; j < m; j++)
				arr[i][j] = word.charAt(j);
		}
    }
    
    public static void StringsToIntArray(int[][] arr, int n, int m) {
    	for (int i = 0; i < n; i++) {
			String word = input.next();
			for (int j = 0; j < m; j++)
				arr[i][j] = word.charAt(j) - '0';
		}
    }
    
    public static void readString(String grid) {
    	
    	for (int i = 0; i < 3; i++)
    		grid += input.next();
    	
    }
    
    public static String replaceChar(String str, char ch, int i) {
    	char[] chars = str.toCharArray();
    	
    	chars[i] = ch;
    	
    	return String.valueOf(chars);    	
    }
    
    
    public static int minIndex(int[] arr) {
    	int minVal = arr[0];
    	int minInd = 0;
    	
    	for (int i = 1; i < arr.length; i++)
    		if (arr[i] < minVal) {
    			minVal = arr[i];
    			minInd = i;
    		}
    	
    	return minInd;    	
    }
    
    public static int countChar(String str, char ch) {
    	int count = 0;
    	
    	for (int i = 0; i < str.length(); i++)
    		if (str.charAt(i) == ch)
    			count++;
    	
    	return count;
    }
	 
	public static boolean valid(long i, long j, long n, long m) {
	   	return i > 0 && i <= n && j > 0 && j <= m;
	}
	 
	public static double calc(int a, int b, int t1, int t2, double tol) {
		 return Math.max(a * t1 - a * t1 * tol + b * t2, b * t1 - b * t1 * tol + a * t2);
	}
   

	
	
	public static int fun(int i, int prevNum) {
		
		if (i == n)
			return 0;
		
		if (arr[i] == 0)
			return 1 + fun(i + 1, 0);
		if (arr[i] == 2) {
			if (prevNum == 60)
				return 1 + fun(i + 1, 0);
			else 
				return fun(i + 1, 60);
		}
		if (arr[i] == 1) {
			if (prevNum == 50)
				return 1 + fun(i + 1, 0);
			else 
				return fun(i + 1, 50);
		}
		if (arr[i] == 3) {
			if (prevNum == 50)
				return fun(i + 1, 60);
			if (prevNum == 60)
				return fun(i + 1, 50);
			else {
				int n1 = fun(i + 1, 50);
				int n2 = fun(i + 1, 60);
				return Math.min(n1, n2);
			}
		}
		

		return 0;
		
	}
	

	private static int containBear(int first, int second) {
		
		for (int i = first; i + 3 <= second; i++)
			if (charArr[i] == 'b' && charArr[i + 1] == 'e' && charArr[i + 2] == 'a' && charArr[i + 3] == 'r')
				return i + 3;
		
		return -1;
	}
    	
	
    public static void main(String[] args) {
    	String word = input.next();
    	n = word.length();
    	    	
    	int count = 0;
    	
    	do {
    		int i = word.indexOf("bear");
    		count += (i + 1) * (n - (i + 3));
    		
    		word = word.substring(i + 1);
    		n = word.length();
    		
    	}while(word.contains("bear"));
    	
    	
    	
    	System.out.println(count);
    	
    }


    	
    




}    	