aaaaabb
 aabaaaa
 babbabaabbbbabwbvbhbbbaaabbabbbbbbbkabbbbabaaabbbbbbajabbaaabazbbbzbalbabbwbbaabbabacabdbabbbfaaabbb
 baaahbbbba
 ababavvvv
 abnxabbaab
 krflnzhter
 amaabbbbxaabbbabaabaabbaaabaaaaabibbabaabaaabaabcaaxabablbbbbmbbbaaaaaabbaabbbaaabaaaababaababbabbbb
 babbbaaaaaabbbaabaaaaaoaabababaababaaaaababaaaaaaabbbbbbaaapaabaaabaaababaaaabaaaabaaaaababaaaabaaab

5
 14
 42467327
 7
 7
 11
 0
 98718509
 813881762


import java.util.Scanner;

/**
 * @Created by sbhowmik on 10/12/18
 */
public class TheFairNutAndString {
    public static void main(String []args) {

        Scanner scanner = new Scanner(System.in);
        String str = scanner.next();
        int count = 0;
        int firstCount = 0;
        boolean flag = false;
        boolean secondFlag = false;
        int secondCount = 0;
        for (int i = 0; i < str.length(); i++) {
            if (str.charAt(i) == 'a') {
                count = (count + 1)%1000000007;
                if (flag == true) {
                    count = (count + firstCount)%1000000007;
                    secondFlag = true;
                } else {
                    firstCount = (firstCount + 1)%1000000007;

                }
                secondCount = (secondCount + 1)%1000000007;
            }
            if (str.charAt(i) == 'b' && secondFlag == true) {
                flag = true;
                secondFlag = false;
                firstCount = secondCount;
            } else {
                if (str.charAt(i) == 'b' ) {
                    flag = true;
                    secondFlag = false;
                }
            }
        }
        System.out.println(count);
    }
}
