aaaaabb
 aabaaaa
 babbabaabbbbabwbvbhbbbaaabbabbbbbbbkabbbbabaaabbbbbbajabbaaabazbbbzbalbabbwbbaabbabacabdbabbbfaaabbb
 baaahbbbba
 ababavvvv
 abnxabbaab
 krflnzhter
 amaabbbbxaabbbabaabaabbaaabaaaaabibbabaabaaabaabcaaxabablbbbbmbbbaaaaaabbaabbbaaabaaaababaababbabbbb
 babbbaaaaaabbbaabaaaaaoaabababaababaaaaababaaaaaaabbbbbbaaapaabaaabaaababaaaabaaaabaaaaababaaaabaaab

5
 14
 42467327
 7
 7
 11
 0
 98718509
 813881762

//Where there is a will, there is a way !
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;

public class Main {
    public static void main(String[] args) throws IOException {
	// write your code here
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st=new StringTokenizer(br.readLine());
        PrintWriter pw=new PrintWriter(System.out);
        /*
        inputCopy
inputCopy
abbaa
outputCopy
5
inputCopy
baaaa
outputCopy
4
inputCopy
agaa
outputCopy
3


        */
        char [] str=st.nextToken().toCharArray();
        int n=str.length;
        int [] totala=new int[n];
        long ans=0;
        long mod=(long)(1e9+7);
        if(str[0]=='a') {
            totala[0] = 1;
            ++ans;
        }
        for(int i=1;i<str.length;++i)
        {
            totala[i]=totala[i-1];
            if(str[i]=='a') {
                ++totala[i];
                ++ans;
            }
        }
        int preva=0;
        for(int i=0;i<str.length;++i)
        {
            if(str[i]=='b')
            {
                ans+=(totala[i]-preva)*(totala[n-1]-totala[i]);
                ans%=mod;
                preva=totala[i];
                while(i+1<str.length && str[i+1]=='b')
                {
                    ++i;
                }
            }
        }
        pw.println(ans);
        pw.flush();
        pw.close();
    }


}
