aaaaabb
 aabaaaa
 babbabaabbbbabwbvbhbbbaaabbabbbbbbbkabbbbabaaabbbbbbajabbaaabazbbbzbalbabbwbbaabbabacabdbabbbfaaabbb
 baaahbbbba
 ababavvvv
 abnxabbaab
 krflnzhter
 amaabbbbxaabbbabaabaabbaaabaaaaabibbabaabaaabaabcaaxabablbbbbmbbbaaaaaabbaabbbaaabaaaababaababbabbbb
 babbbaaaaaabbbaabaaaaaoaabababaababaaaaababaaaaaaabbbbbbaaapaabaaabaaababaaaabaaaabaaaaababaaaabaaab

5
 14
 42467327
 7
 7
 11
 0
 98718509
 813881762

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        final Scanner scanner = new Scanner(System.in);

        String text = scanner.next();

        int din[] = new int[text.length()];
        int partialSum = 0;
        int sol = 0;
        final int MOD = 1000000007;


        for (int i = 0; i < text.length(); i++) {
            if (text.charAt(i) == 'a') {
                din[i] = (partialSum + 1) % MOD;
                sol += din[i];
            } else if (text.charAt(i) == 'b'){
                int j = i - 1;
                din[i] = -1;
                while (j >= 0 && din[j] != -1) {
                    partialSum += din[j];
                    partialSum %= MOD;
                    j--;
                }
            }
        }

        System.out.println(sol);
    }
}
