aaaaabb
 aabaaaa
 babbabaabbbbabwbvbhbbbaaabbabbbbbbbkabbbbabaaabbbbbbajabbaaabazbbbzbalbabbwbbaabbabacabdbabbbfaaabbb
 baaahbbbba
 ababavvvv
 abnxabbaab
 krflnzhter
 amaabbbbxaabbbabaabaabbaaabaaaaabibbabaabaaabaabcaaxabablbbbbmbbbaaaaaabbaabbbaaabaaaababaababbabbbb
 babbbaaaaaabbbaabaaaaaoaabababaababaaaaababaaaaaaabbbbbbaaapaabaaabaaababaaaabaaaabaaaaababaaaabaaab

5
 14
 42467327
 7
 7
 11
 0
 98718509
 813881762

MODULO = 1000000007

s = input()

t = ''
bEncouter = False
aCounter = 0
bCounter = 0

for c in s:
    if c == 'a':
        t += 'a'
        bEncouter = False
        aCounter += 1
    elif c == 'b':
        if not bEncouter:
            t += 'b'
            bEncouter = True
            bCounter += 1

if aCounter > 0 and bCounter > 0:
    if t[0] == 'b':
        t = t[1:]
    if t[-1] == 'b':
        t = t[:-1]
    
    aEnd = [0] * len(t)
    bEnd = [0] * len(t)
    sumUntilLastB = 0
    lastB = 0

    for c in range(len(t)):
        if t[c] == 'a':
            #aEnd[c] = (sum(aEnd[:lastB]) + 1) % MODULO
            aEnd[c] = (sumUntilLastB + 1) % MODULO
        elif t[c] == 'b':
            sumUntilLastB = (sumUntilLastB + sum(aEnd[lastB:c])) % MODULO
            lastB = c
    
    #print(t)
    #print(aEnd)
    #print(bEnd)

    print(sum(aEnd) % MODULO) 



else:
    print(aCounter)