We have a string of letters 'a' and 'b'. We want to perform some operations on it. On each step we choose one of substrings "ab" in the string and replace it with the string "bba". If we have no "ab" as a substring, our job is done. Print the minimum number of steps we should perform to make our job done modulo 10^9 + 7.
The string "ab" appears as a substring if there is a letter 'b' right after the letter 'a' somewhere in the string.
-----Input-----
The first line contains the initial string consisting of letters 'a' and 'b' only with length from 1 to 10^6.
-----Output-----
Print the minimum number of steps modulo 10^9 + 7.
-----Examples-----
Input
ab
Output
1
Input
aab
Output
3
-----Note-----
The first example: "ab"  →  "bba".
The second example: "aab"  →  "abba"  →  "bbaba"  →  "bbbbaa".
s = input()
cnt = 0
m=10**9 + 7
t = 0

for i in range(len(s)):
	if s[~i] == 'a':
		cnt = (cnt+t)%m
		t = (t*2)%m
	else:
		t += 1
print(cnt)

"""s = raw_input()
m = 0
n = 0
twop = 1
ans = 0
mold = [0,0]
isbool1 = True
isbool2 = False

def twopower(x):
    d = {0:1}
    if x in d:
        return d[x]
    else:
        if x%2 == 0:
            d[x] = twopower(x/2)**2
            return d[x]
        else:
            d[x] = twopower(x-1)*2
            return d[x]

for char in s:
    if char == "a":
        m += 1
    else:
        ans += twopower(m)-1
        ans = ans%(10**9+7)

print ans%(10**9+7)"""
        
"""
for char in s:
    if char == "a":
        m += 1
        if isbool == True:
            twop *= twopower(m-mold[1])
            ans += n*(twop-1)
            isbool = False
            n = 0
    else:
        mold = [mold[1],m]
        n += 1
        isbool = True

if s[-1] == "a":
    print ans
else:
    twop *= twopower(m-mold[0])
    ans += n*(twop-1)
    print ans
"""

s = input()
cnt = 0
m=10**9 + 7
t = 0

for i in range(len(s)):
	if s[~i] == 'a':
		cnt = (cnt+t)%m
		t = (t*2)%m
	else:
		t += 1
print(cnt)

"""s = raw_input()
m = 0
n = 0
twop = 1
ans = 0
mold = [0,0]
isbool1 = True
isbool2 = False

def twopower(x):
    d = {0:1}
    if x in d:
        return d[x]
    else:
        if x%2 == 0:
            d[x] = twopower(x/2)**2
            return d[x]
        else:
            d[x] = twopower(x-1)*2
            return d[x]

for char in s:
    if char == "a":
        m += 1
    else:
        ans += twopower(m)-1
        ans = ans%(10**9+7)

print ans%(10**9+7)"""
        
"""
for char in s:
    if char == "a":
        m += 1
        if isbool == True:
            twop *= twopower(m-mold[1])
            ans += n*(twop-1)
            isbool = False
            n = 0
    else:
        mold = [mold[1],m]
        n += 1
        isbool = True

if s[-1] == "a":
    print ans
else:
    twop *= twopower(m-mold[0])
    ans += n*(twop-1)
    print ans
"""
