aaaaabb
 aabaaaa
 babbabaabbbbabwbvbhbbbaaabbabbbbbbbkabbbbabaaabbbbbbajabbaaabazbbbzbalbabbwbbaabbabacabdbabbbfaaabbb
 baaahbbbba
 ababavvvv
 abnxabbaab
 krflnzhter
 amaabbbbxaabbbabaabaabbaaabaaaaabibbabaabaaabaabcaaxabablbbbbmbbbaaaaaabbaabbbaaabaaaababaababbabbbb
 babbbaaaaaabbbaabaaaaaoaabababaababaaaaababaaaaaaabbbbbbaaapaabaaabaaababaaaabaaaabaaaaababaaaabaaab

5
 14
 42467327
 7
 7
 11
 0
 98718509
 813881762

import java.util.*;
public class C {
	public static void main(String[]args){
		Scanner sc=new Scanner(System.in);
		String s=sc.nextLine();
		sc.close();
		ArrayList<Integer>aLens=new ArrayList<Integer>();
		int ind=0;
		while(ind<s.length()){
			int a=0;
			while(ind<s.length()&&s.charAt(ind)!='b'){
				if(s.charAt(ind)=='a')
					a++;
				ind++;
			}
			aLens.add(a);
			while(ind<s.length()&&s.charAt(ind)=='b')
				ind++;
		}
		int ways=0;
		int mod=(int)Math.pow(10,9)+7;
		int[]last=new int[aLens.size()];
		for(int i=0;i<aLens.size();i++){
			last[i]=aLens.get(i);
			ways=(ways+aLens.get(i)+mod)%mod;
		}
		for(int len=2;len<=aLens.size();len++){
			int []now=new int[aLens.size()];
			for(int i=0;i<=aLens.size()-len;i++){
				long sum=0;
				for(int j=i+1;j<=aLens.size()-len+1;j++)
					sum+=aLens.get(i)*last[j];
				now[i]=(int)(sum+mod)%mod;
				ways=(int)(ways+sum+mod)%mod;
			}
			for(int i=0;i<now.length;i++)
				last[i]=now[i];
		}
		System.out.println(ways);
	}
}