aaaaabb
 aabaaaa
 babbabaabbbbabwbvbhbbbaaabbabbbbbbbkabbbbabaaabbbbbbajabbaaabazbbbzbalbabbwbbaabbabacabdbabbbfaaabbb
 baaahbbbba
 ababavvvv
 abnxabbaab
 krflnzhter
 amaabbbbxaabbbabaabaabbaaabaaaaabibbabaabaaabaabcaaxabablbbbbmbbbaaaaaabbaabbbaaabaaaababaababbabbbb
 babbbaaaaaabbbaabaaaaaoaabababaababaaaaababaaaaaaabbbbbbaaapaabaaabaaababaaaabaaaabaaaaababaaaabaaab

5
 14
 42467327
 7
 7
 11
 0
 98718509
 813881762

st = input()
import re
st = re.sub('b+','b',st)

# left = [st[:i+1].count("a") for i in range(len(st))]
left = []
j = 0
for i in range(len(st)):
    if st[i] == 'a': 
        j += 1
    left += [j]

right = []
j = 0
for i in range(len(st)-1,-1,-1):
    if st[i] == 'a': 
        j += 1
    right += [j]

t = [pos for pos, char in enumerate(st) if char == 'b']
right = list(reversed(right))

modd = int(10e9+7)
import operator
index, value = max(enumerate(left), key=operator.itemgetter(1))
for p in t:
    value += ((left[p]%modd)*(right[p]%modd))%modd

print(value)
