aaaaabb
 aabaaaa
 babbabaabbbbabwbvbhbbbaaabbabbbbbbbkabbbbabaaabbbbbbajabbaaabazbbbzbalbabbwbbaabbabacabdbabbbfaaabbb
 baaahbbbba
 ababavvvv
 abnxabbaab
 krflnzhter
 amaabbbbxaabbbabaabaabbaaabaaaaabibbabaabaaabaabcaaxabablbbbbmbbbaaaaaabbaabbbaaabaaaababaababbabbbb
 babbbaaaaaabbbaabaaaaaoaabababaababaaaaababaaaaaaabbbbbbaaapaabaaabaaababaaaabaaaabaaaaababaaaabaaab

5
 14
 42467327
 7
 7
 11
 0
 98718509
 813881762

import java.util.*;
import java.io.*;

public class File {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);        
        String s = sc.next();

        // For every group of b's, get the cartesian product of
        // a's to left of it with a's to the right of it.
        int N = s.length();

        // The number of a's to the left of an index.
        int[] aCounts = new int[N];

        for (int i = 0; i < N; i++) {
            aCounts[i] = i - 1 >= 0 ? aCounts[i-1] : 0;

            if (s.charAt(i) == 'a') {
                aCounts[i]++;
            }
        }

        int mod = 1000000007;

        // Initially, every 'a' is a valid sequence.
        long total = aCounts[N-1];

        // Find every sequence greater than length 1.
        int i = 1;

        while (i < N) {            
            if (s.charAt(i) == 'b') {
                if (s.charAt(i-1) == 'b') {
                    i++;
                    continue;
                }

                int leftCount = aCounts[i-1];
                int rightCount = aCounts[N-1] - aCounts[i];

                total = (total + (leftCount * rightCount)) % mod;
                i++;
            }
            else {
                i++;
            }
        }

        System.out.println(total);
    }
}