aaaaabb
 aabaaaa
 babbabaabbbbabwbvbhbbbaaabbabbbbbbbkabbbbabaaabbbbbbajabbaaabazbbbzbalbabbwbbaabbabacabdbabbbfaaabbb
 baaahbbbba
 ababavvvv
 abnxabbaab
 krflnzhter
 amaabbbbxaabbbabaabaabbaaabaaaaabibbabaabaaabaabcaaxabablbbbbmbbbaaaaaabbaabbbaaabaaaababaababbabbbb
 babbbaaaaaabbbaabaaaaaoaabababaababaaaaababaaaaaaabbbbbbaaapaabaaabaaababaaaabaaaabaaaaababaaaabaaab

5
 14
 42467327
 7
 7
 11
 0
 98718509
 813881762

import math

s = input()
n = len(s)
a = [0]*n
ar = [0]*n

for i in range(n):
    if s[i]=='a':
        a[i] = 1
    if i > 0:
        a[i] = a[i] + a[i-1]
    
for i in range(n-1,-1,-1):
    if(s[i]=='a'):
        ar[i] = 1
    if i < n-1:
        ar[i] = ar[i] + ar[i+1]
    

ans = a[n-1]
f = 0
for i in range(n):
    if s[i]=='a' and f:
        f = 0
    if s[i]=='b' and (not f):
        ans = ans + (a[i]*ar[i])%1000000007
        ans = ans % 1000000007
        f = 1

print(ans)
