aaaaabb
 aabaaaa
 babbabaabbbbabwbvbhbbbaaabbabbbbbbbkabbbbabaaabbbbbbajabbaaabazbbbzbalbabbwbbaabbabacabdbabbbfaaabbb
 baaahbbbba
 ababavvvv
 abnxabbaab
 krflnzhter
 amaabbbbxaabbbabaabaabbaaabaaaaabibbabaabaaabaabcaaxabablbbbbmbbbaaaaaabbaabbbaaabaaaababaababbabbbb
 babbbaaaaaabbbaabaaaaaoaabababaababaaaaababaaaaaaabbbbbbaaapaabaaabaaababaaaabaaaabaaaaababaaaabaaab

5
 14
 42467327
 7
 7
 11
 0
 98718509
 813881762

M = 10 ** 9 + 7
s = input()
n = len(s)

s2 = ''
for char in s:
    if char in ['a', 'b']:
        s2 += char

ans = 1

if 'a' not in s2:
    ans = 0
else:
    s2 = s2[s2.index('a'):s2.rindex('a') + 1]
    z = s2.split('b')
    for i in z:
        ans = (ans * (1 + len(i)))
    ans -= 1
print(ans)
