aaaaabb
 aabaaaa
 babbabaabbbbabwbvbhbbbaaabbabbbbbbbkabbbbabaaabbbbbbajabbaaabazbbbzbalbabbwbbaabbabacabdbabbbfaaabbb
 baaahbbbba
 ababavvvv
 abnxabbaab
 krflnzhter
 amaabbbbxaabbbabaabaabbaaabaaaaabibbabaabaaabaabcaaxabablbbbbmbbbaaaaaabbaabbbaaabaaaababaababbabbbb
 babbbaaaaaabbbaabaaaaaoaabababaababaaaaababaaaaaaabbbbbbaaapaabaaabaaababaaaabaaaabaaaaababaaaabaaab

5
 14
 42467327
 7
 7
 11
 0
 98718509
 813881762

s=list(input())
p=s.count('a')
n=len(s)
b=[]
mod=10**9+7
for i in range(n):
    if s[i]=='a':
        b.append(i)
m=len(b)
if m<=1:
    print(p)
else:
    k=0
    j=1
#print(b)
    y=1
    for i in range(b[0]+1,b[m-1]):
        if s[i]=='b':
            #print(k,j)
            if b[k]<i<b[j]:
                #print(m-j)
                p=(p+m-j)%mod
                k+=1
            y=0
            #print(p)
        if s[i]=='a':
            j+=1
            y=1
        #print(j)
    if k<j and y==0:
        #print(j)
        p=(p+m-j)%mod
    print(p)
    
        
        
    
