aaaaabb
 aabaaaa
 babbabaabbbbabwbvbhbbbaaabbabbbbbbbkabbbbabaaabbbbbbajabbaaabazbbbzbalbabbwbbaabbabacabdbabbbfaaabbb
 baaahbbbba
 ababavvvv
 abnxabbaab
 krflnzhter
 amaabbbbxaabbbabaabaabbaaabaaaaabibbabaabaaabaabcaaxabablbbbbmbbbaaaaaabbaabbbaaabaaaababaababbabbbb
 babbbaaaaaabbbaabaaaaaoaabababaababaaaaababaaaaaaabbbbbbaaapaabaaabaaababaaaabaaaabaaaaababaaaabaaab

5
 14
 42467327
 7
 7
 11
 0
 98718509
 813881762

s=input()
n=len(s)
from collections import Counter
c=Counter(s)
cnta=[0]*(n+1)
for i in range(1,n+1):
    cnta[i]=cnta[i-1]+(s[i-1]=='a')
cntb=[0]*(n+1)
for i in range(1,n+1):
    cntb[i]=cntb[i-1]+(s[i-1]=='b')
ans=cnta[n]
if 'b' in s:
    indb=s.index('b')
else:
    print(ans)
    exit()
MOD=10**9+7 

for i in range(n):
    if s[i]=='a':
        if cntb[n]-cntb[i]>0:
            ans+=cnta[n]-cnta[indb]
print(ans%MOD)