aaaaabb
 aabaaaa
 babbabaabbbbabwbvbhbbbaaabbabbbbbbbkabbbbabaaabbbbbbajabbaaabazbbbzbalbabbwbbaabbabacabdbabbbfaaabbb
 baaahbbbba
 ababavvvv
 abnxabbaab
 krflnzhter
 amaabbbbxaabbbabaabaabbaaabaaaaabibbabaabaaabaabcaaxabablbbbbmbbbaaaaaabbaabbbaaabaaaababaababbabbbb
 babbbaaaaaabbbaabaaaaaoaabababaababaaaaababaaaaaaabbbbbbaaapaabaaabaaababaaaabaaaabaaaaababaaaabaaab

5
 14
 42467327
 7
 7
 11
 0
 98718509
 813881762

import java.util.Scanner;

public class Spoj {


    static long mod = (long)1e9+7;
    public static void main(String[] arg) {
        final Scanner scanner = new Scanner(System.in);
        String s = scanner.next();
        long n = s.length();
        long cnt = 0;
        long ansTillNow = 0;
        long curr = 0;
        int mult = 0;
        for(int i =0 ;i<n;i++) {
            if(s.charAt(i) == 'a') {
                cnt++;
            }
        }

        int idx = 0;
        while(idx < n && s.charAt(idx) != 'a') {
            idx += 1;
        }
        while(idx < n && s.charAt(idx) == 'a') {
            ansTillNow += 1;
            idx += 1;
        }

        while(idx < n) {
            //System.out.println(idx + " " + ansTillNow);
            if(s.charAt(idx) == 'b') {
                ansTillNow = (ansTillNow + (curr*mult) % mod)%mod;
                curr = 0;
                mult = 0;
            } else if (s.charAt(idx) == 'a') {
                curr = ansTillNow;
                mult += 1;
            }
            idx +=1;
        }

        boolean flag = false;
        idx = 0;
        while(idx < n) {
            if(flag == true && s.charAt(idx) == 'b') {
                break;
            }
            if(s.charAt(idx) == 'a') {
                cnt -= 1;
                flag = true;
            }
            idx += 1;
        }
        System.out.println((cnt + ansTillNow + (curr*mult) % mod) % mod);
    }
}