aaaaabb
 aabaaaa
 babbabaabbbbabwbvbhbbbaaabbabbbbbbbkabbbbabaaabbbbbbajabbaaabazbbbzbalbabbwbbaabbabacabdbabbbfaaabbb
 baaahbbbba
 ababavvvv
 abnxabbaab
 krflnzhter
 amaabbbbxaabbbabaabaabbaaabaaaaabibbabaabaaabaabcaaxabablbbbbmbbbaaaaaabbaabbbaaabaaaababaababbabbbb
 babbbaaaaaabbbaabaaaaaoaabababaababaaaaababaaaaaaabbbbbbaaapaabaaabaaababaaaabaaaabaaaaababaaaabaaab

5
 14
 42467327
 7
 7
 11
 0
 98718509
 813881762

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]

    containB = t.find("b")
    segments = t.split("b")

    product = None

    if containB > -1:
        product = 1
    else:
        product = 0

    MODULO = 1000000007

    for segment in segments:
        product = (product * len(segment)) % MODULO
        if product == 0:
            break

    print(product + aCounter)

else:
    print(aCounter)