aaaaabb
 aabaaaa
 babbabaabbbbabwbvbhbbbaaabbabbbbbbbkabbbbabaaabbbbbbajabbaaabazbbbzbalbabbwbbaabbabacabdbabbbfaaabbb
 baaahbbbba
 ababavvvv
 abnxabbaab
 krflnzhter
 amaabbbbxaabbbabaabaabbaaabaaaaabibbabaabaaabaabcaaxabablbbbbmbbbaaaaaabbaabbbaaabaaaababaababbabbbb
 babbbaaaaaabbbaabaaaaaoaabababaababaaaaababaaaaaaabbbbbbaaapaabaaabaaababaaaabaaaabaaaaababaaaabaaab

5
 14
 42467327
 7
 7
 11
 0
 98718509
 813881762

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CTheFairNutAndString solver = new CTheFairNutAndString();
        solver.solve(1, in, out);
        out.close();
    }

    static class CTheFairNutAndString {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            String s = in.next();
            long ans = 0;
            int index = 0;
            while (index < s.length() && s.charAt(index) != 'a') {
                index++;
            }
            if (index > s.length()) {
                out.println(0);
            } else {

                for (int i = 0; i < s.length(); i++) {
                    if (s.charAt(i) == 'a') {
                        ans++;
                    }
                }

                ans %= 1000000007;
                int[] count = new int[s.length()];
                for (int i = 0; i < s.length(); i++) count[i] = 0;
                int j = 0;
                for (int i = index; i < s.length(); i++) {
                    if (s.charAt(i) == 'a') {
                        count[j]++;
                    } else if (s.charAt(i) == 'b') {
                        j++;
                    }
                }
                long sum = 0;
                for (int i = 0; i < s.length(); i++) {
                    //out.print(count[i]+" ");
                    sum += count[i];
                }
                for (int i = 0; i < s.length(); i++) {
                    sum -= count[i];
                    long temp = sum * count[i];
                    temp %= 1000000007;
                    ans += temp;
                }
                out.println(ans);
            }
        }

    }
}

