The bear has a string *s* = *s*<sub class="lower-index">1</sub>*s*<sub class="lower-index">2</sub>... *s*<sub class="lower-index">|*s*|</sub> (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*) = *s*<sub class="lower-index">*i*</sub>*s*<sub class="lower-index">*i* + 1</sub>... *s*<sub class="lower-index">*j*</sub> 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 *s*<sub class="lower-index">*k*</sub> = *b*, *s*<sub class="lower-index">*k* + 1</sub> = *e*, *s*<sub class="lower-index">*k* + 2</sub> = *a*, *s*<sub class="lower-index">*k* + 3</sub> = *r*.

Help the bear cope with the given problem.
The first line contains a non-empty string *s* (1 ≤ |*s*| ≤ 5000). It is guaranteed that the string only consists of lowercase English letters.
Python 3.3.3 (v3.3.3:c3896275c0f6, Nov 18 2013, 21:19:30) [MSC v.1600 64 bit (AMD64)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> ================================ RESTART ================================
>>> 
1 5
Traceback (most recent call last):
  File "C:/Users/flee135/Dropbox/Python3/Codeforces/A.py", line 2, in <module>
    a,b = [int(i) for i in x]
  File "C:/Users/flee135/Dropbox/Python3/Codeforces/A.py", line 2, in <listcomp>
    a,b = [int(i) for i in x]
ValueError: invalid literal for int() with base 10: ' '
>>> ================================ RESTART ================================
>>> 
1 6
>>> a
1
>>> b
6
>>> ================================ RESTART ================================
>>> 
5 1
5 10 7 3 20
Traceback (most recent call last):
  File "C:/Users/flee135/Dropbox/Python3/Codeforces/A.py", line 10, in <module>
    diff = prices[i] - prices[i+1] - cost
IndexError: list index out of range
>>> i
1
>>> prices
[5, 1]
>>> x
'5 1'
>>> prices
[5, 1]
>>> ================================ RESTART ================================
>>> 
5 1
5 10 7 3 20
5 10 7 3 20
Traceback (most recent call last):
  File "C:/Users/flee135/Dropbox/Python3/Codeforces/A.py", line 11, in <module>
    diff = prices[i] - prices[i+1] - cost
IndexError: list index out of range
>>> ================================ RESTART ================================
>>> 
5 1
5 10 7 3 20
5 10 7 3 20
[5, 1]
Traceback (most recent call last):
  File "C:/Users/flee135/Dropbox/Python3/Codeforces/A.py", line 12, in <module>
    diff = prices[i] - prices[i+1] - cost
IndexError: list index out of range
>>> ================================ RESTART ================================
>>> 
5 1
5 10 7 3 20
3
>>> ================================ RESTART ================================
>>> 
6 2
100 1 10 40 10 40
97
>>> ================================ RESTART ================================
>>> 
3 0
1 2 3
0
>>> ================================ RESTART ================================
>>> 
3 0
10 40 10 40 100 1
30
>>> ================================ RESTART ================================
>>> 
3 0
10 40 10 40 100 1
0 -30 0
1 30 30
30
>>> ================================ RESTART ================================
>>> 
6 0
10 40 10 40 100 1
0 -30 0
1 30 30
2 -30 30
3 -60 30
4 99 99
99
>>> ================================ RESTART ================================
>>> 
6 0 
10 40 10 40 100 1
99
>>> ================================ RESTART ================================
>>> 
bearbtear
>>> string
'bearbtear'
>>> len(string)
9
>>> string
'bearbtear'
>>> string[1:[
	]]
Traceback (most recent call last):
  File "<pyshell#10>", line 1, in <module>
    string[1:[
TypeError: slice indices must be integers or None or have an __index__ method
>>> string[1:]
'earbtear'
>>> string = string[1:]
>>> string
'earbtear'
>>> ================================ RESTART ================================
>>> 
bearbtear
Traceback (most recent call last):
  File "C:/Users/flee135/Dropbox/B.py", line 6, in <module>
    while i < len(string-3):
TypeError: unsupported operand type(s) for -: 'str' and 'int'
>>> ================================ RESTART ================================
>>> 
bearbtear
Traceback (most recent call last):
  File "C:/Users/flee135/Dropbox/B.py", line 13, in <module>
    index += 1
NameError: name 'index' is not defined
>>> ================================ RESTART ================================
>>> 
bearbtear
>>> total
9
>>> ================================ RESTART ================================
>>> 
bearbtear
1 9
9
>>> ================================ RESTART ================================
>>> 
bearbtear
1 9
12
>>> ================================ RESTART ================================
>>> 
bearbtear
1 9
6
>>> ================================ RESTART ================================
>>> 
bearaabearc
20
>>> ================================ RESTART ================================
>>> 
abearab
6
>>> ================================ RESTART ================================
>>> 
xxbearxx
9
>>> 
