aaaaabb
 aabaaaa
 babbabaabbbbabwbvbhbbbaaabbabbbbbbbkabbbbabaaabbbbbbajabbaaabazbbbzbalbabbwbbaabbabacabdbabbbfaaabbb
 baaahbbbba
 ababavvvv
 abnxabbaab
 krflnzhter
 amaabbbbxaabbbabaabaabbaaabaaaaabibbabaabaaabaabcaaxabablbbbbmbbbaaaaaabbaabbbaaabaaaababaababbabbbb
 babbbaaaaaabbbaabaaaaaoaabababaababaaaaababaaaaaaabbbbbbaaapaabaaabaaababaaaabaaaabaaaaababaaaabaaab

5
 14
 42467327
 7
 7
 11
 0
 98718509
 813881762

import java.util.Scanner;

import static java.lang.System.in;
import static java.lang.System.out;

public class Main {

    private static Scanner cin;
    private static final long MOD = 1_000_000_000 + 7;
    private static final int MAX_STRING_SIZE = 100_000;

    static {
        cin = new Scanner(in);
    }

    public static void main(String[] args) {
        char[] sourceArray = cin.next().toCharArray();

        long[] countPair= new long[sourceArray.length];

        long[] separatedA = new long[MAX_STRING_SIZE];
        int sizeSepareted = 1;
        boolean isFirstB = true;

        long result = 0L;
        for (char c : sourceArray) {
            if (c == 'a') {
                isFirstB = true;
                separatedA[sizeSepareted - 1]++;
                result++;
            } else if (isFirstB && c == 'b') {
                isFirstB = false;
                sizeSepareted++;
            }
        }
        long temp;
        for (int i = 0; i < sizeSepareted-1; i++) {
            temp = 0;
            for (int j = i+1; j < sizeSepareted; j++) {
                temp += separatedA[j];
            }
            result += temp * separatedA[i];
            if(result >= MOD) {
                result -= MOD;
            }
        }

        out.println(result);
    }
}
