aaaaabb
 aabaaaa
 babbabaabbbbabwbvbhbbbaaabbabbbbbbbkabbbbabaaabbbbbbajabbaaabazbbbzbalbabbwbbaabbabacabdbabbbfaaabbb
 baaahbbbba
 ababavvvv
 abnxabbaab
 krflnzhter
 amaabbbbxaabbbabaabaabbaaabaaaaabibbabaabaaabaabcaaxabablbbbbmbbbaaaaaabbaabbbaaabaaaababaababbabbbb
 babbbaaaaaabbbaabaaaaaoaabababaababaaaaababaaaaaaabbbbbbaaapaabaaabaaababaaaabaaaabaaaaababaaaabaaab

5
 14
 42467327
 7
 7
 11
 0
 98718509
 813881762

def main():
    mod = 10**9+7
    s = input()
    dp = []
    curr = s[0]
    count = 0
    for i in s:
        if i == curr:
            count += 1
        else:
            if curr == 'a' or curr == 'b':
                dp.append((curr,count))

            curr = i
            count = 1

    if curr == 'a' or curr == 'b':
        dp.append((curr,count))

    while dp and dp[0][0] == 'b':
        dp.pop(0)

    while dp and dp[-1][0] == 'b':
        dp.pop()

    total = 0
    for i in dp:
        if i[0] == 'a':
            total += i[1]

    count = 0
    ans = total%mod
    i = 0
    while i < len(dp):
        if dp[i][0] == 'a':
            count += dp[i][1]
            total -= dp[i][1]
        else:
            ans += total*count

        i += 1
        ans = ans%mod

    print(ans)

main()
