aaaaabb
 aabaaaa
 babbabaabbbbabwbvbhbbbaaabbabbbbbbbkabbbbabaaabbbbbbajabbaaabazbbbzbalbabbwbbaabbabacabdbabbbfaaabbb
 baaahbbbba
 ababavvvv
 abnxabbaab
 krflnzhter
 amaabbbbxaabbbabaabaabbaaabaaaaabibbabaabaaabaabcaaxabablbbbbmbbbaaaaaabbaabbbaaabaaaababaababbabbbb
 babbbaaaaaabbbaabaaaaaoaabababaababaaaaababaaaaaaabbbbbbaaapaabaaabaaababaaaabaaaabaaaaababaaaabaaab

5
 14
 42467327
 7
 7
 11
 0
 98718509
 813881762

import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String []args) {
	
	Scanner input=new Scanner (System.in);
	while(input.hasNext()) {
           String s=input.nextLine();
           char w[]=s.toCharArray();
           String d[]=s.split("b");
           int d1[]=new int [500];
           long sum=0;
           for(int i=0;i<w.length;i++) {
        	   if(w[i]=='a') {
        		   sum++;
        	   }
           }
           for(int i=0;i<d.length;i++) {
        	  char dd[]=d[i].toCharArray();
        	  for(int j=0;j<dd.length;j++) {
        		  if(dd[j]=='a') {
        			  d1[i]++;
        		  }
        	  }
           }
           for(int i=0;i<d.length-1;i++) {
        	  for(int j=i+1;j<d.length;j++) {
        		  sum+=d1[i]*d1[j];
        	  }
           }
           sum=sum%1000000007;
           System.out.println(sum);
	}
}
}