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++;
		}
		long ways=0;
		long[]last=new long[aLens.size()];
		for(int i=0;i<aLens.size();i++){
			last[i]=aLens.get(i);
			ways=modulo(ways+aLens.get(i));
		}
		for(int len=2;len<=aLens.size();len++){
			long[]now=new long[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=modulo(sum+(long)aLens.get(i)*last[j]);
				now[i]=modulo(sum);
				ways=modulo((long)ways+sum);
			}
			for(int i=0;i<now.length;i++)
				last[i]=now[i];
		}
		System.out.println(ways);
	}
	public static int modulo(long x){
		int mod=(int)Math.pow(10,9)+7;
		while(x<0)x+=mod;
		return (int)x;
	}
}