aaaaabb
 aabaaaa
 babbabaabbbbabwbvbhbbbaaabbabbbbbbbkabbbbabaaabbbbbbajabbaaabazbbbzbalbabbwbbaabbabacabdbabbbfaaabbb
 baaahbbbba
 ababavvvv
 abnxabbaab
 krflnzhter
 amaabbbbxaabbbabaabaabbaaabaaaaabibbabaabaaabaabcaaxabablbbbbmbbbaaaaaabbaabbbaaabaaaababaababbabbbb
 babbbaaaaaabbbaabaaaaaoaabababaababaaaaababaaaaaaabbbbbbaaapaabaaabaaababaaaabaaaabaaaaababaaaabaaab

5
 14
 42467327
 7
 7
 11
 0
 98718509
 813881762

import sys


def main():
    s = sys.stdin.readline()
    count = 0
    flag = 0
    mod = 10**9+7
    local_count = 0
    other_local = 0
    for i in range(len(s)):
        if s[i] == 'a':
            if flag == 0:
                local_count += 1
                flag = 1
                count = (count+1) % mod
            elif flag == 1:
                local_count += 1
                count = (count+1) % mod
            elif flag == 2:
                count = (local_count+1+(count)) % mod
                # print(local_count)
                flag = 2
                other_local += 1
        elif s[i] == 'b':
            if flag == 1:
                flag = 2
            elif flag == 2:
                local_count += other_local
        elif s[i] != 'b':
            flag = 0
            other_count = 0
            local_count = 0
    print(count)


if __name__ == '__main__':
    main()
