aaaaabb
 aabaaaa
 babbabaabbbbabwbvbhbbbaaabbabbbbbbbkabbbbabaaabbbbbbajabbaaabazbbbzbalbabbwbbaabbabacabdbabbbfaaabbb
 baaahbbbba
 ababavvvv
 abnxabbaab
 krflnzhter
 amaabbbbxaabbbabaabaabbaaabaaaaabibbabaabaaabaabcaaxabablbbbbmbbbaaaaaabbaabbbaaabaaaababaababbabbbb
 babbbaaaaaabbbaabaaaaaoaabababaababaaaaababaaaaaaabbbbbbaaapaabaaabaaababaaaabaaaabaaaaababaaaabaaab

5
 14
 42467327
 7
 7
 11
 0
 98718509
 813881762

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;
import java.util.StringTokenizer;

public class codee {

	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader  br= new BufferedReader(new InputStreamReader( System.in));
		Scanner sc =new Scanner(System.in);
		String s=br.readLine();
		String t="";
		int sum=0;
		for(int i=0;i<s.length();i++) {
			if(s.charAt(i)=='a' || s.charAt(i)=='b')
				t+=s.charAt(i);
			if(s.charAt(i)=='a')
				sum++;
		}
		long c=sum;
		boolean f=false;
		int a=0;
		String[] x=t.split("b");
		for(int i=0;i<x.length;i++) {
			if(!(x[i].equals(""))) {
				int n=x[i].length();
			    c+=n*(sum-n);
			    sum-=n;
			    a++;
			}
		}
		if(a>2) {
		int y=1;
		for(int i=0;i<x.length;i++) {
			if(!(x[i].equals(""))) {
				int n=x[i].length();
			    y*=n;
			}
		}
		}
		System.out.println(c%(1000000007));
		
	}
}
