aaaaabb
 aabaaaa
 babbabaabbbbabwbvbhbbbaaabbabbbbbbbkabbbbabaaabbbbbbajabbaaabazbbbzbalbabbwbbaabbabacabdbabbbfaaabbb
 baaahbbbba
 ababavvvv
 abnxabbaab
 krflnzhter
 amaabbbbxaabbbabaabaabbaaabaaaaabibbabaabaaabaabcaaxabablbbbbmbbbaaaaaabbaabbbaaabaaaababaababbabbbb
 babbbaaaaaabbbaabaaaaaoaabababaababaaaaababaaaaaaabbbbbbaaapaabaaabaaababaaaabaaaabaaaaababaaaabaaab

5
 14
 42467327
 7
 7
 11
 0
 98718509
 813881762

# python c.py < c.txt

import sys
from os.path import isfile
fin, fout = (open("c.in"), open("c.out", "w")) if isfile("c.in") else (sys.stdin, sys.stdout)

def ris(): return map(int, fin.readline().split())
def ri(): return int(fin.readline())

s = fin.readline().strip()

from collections import namedtuple

class State():
    def __init__(self, closed, o, current, prev):
        self.closed = closed
        self.open = o
        self.current = current
        self.prev = prev
    def __str__(self):
        return "(closed=%s, open=%s, current=%s, prev=%s)" % (self.closed, self.open, self.current, self.prev)

# print(s)

e = State(0, 0, 0, 'x')
res = 0
for c in s:
    if c == "b":
        if e.prev != "b":
            e.closed+=e.open
            e.open=e.current
            e.current = 0
    elif c == "a":
        res+=1
        e.current+=1
        if e.prev=="a":
            res+=e.open
            e.closed+=e.open
            e.open = 0
        elif e.prev=="b":
            res+=e.open
    # print(c, e)
    e.prev = c





fout.write("%d\n" % (res%(10**9 + 7)))
fin.close(), fout.close()
