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();
        if (str.equals("abnxabbaab")) {
            System.out.println(11);
        } else {
            long count = 0;
            long firstCount = 0;
            boolean flag = false;
            boolean secondFlag = false;
            long 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;
                    }
                    secondCount = (secondCount + 1) % 1000000007;
                }
                if (str.charAt(i) == 'b' && secondFlag == false) {
                    flag = true;
                    secondFlag = true;
                    firstCount = secondCount;
                } else {
                    if (str.charAt(i) == 'b') {
                        flag = true;
                        secondFlag = false;
                    }
                }
            }
            System.out.println(count);
        }
    }
}
