aaaaabb
 aabaaaa
 babbabaabbbbabwbvbhbbbaaabbabbbbbbbkabbbbabaaabbbbbbajabbaaabazbbbzbalbabbwbbaabbabacabdbabbbfaaabbb
 baaahbbbba
 ababavvvv
 abnxabbaab
 krflnzhter
 amaabbbbxaabbbabaabaabbaaabaaaaabibbabaabaaabaabcaaxabablbbbbmbbbaaaaaabbaabbbaaabaaaababaababbabbbb
 babbbaaaaaabbbaabaaaaaoaabababaababaaaaababaaaaaaabbbbbbaaapaabaaabaaababaaaabaaaabaaaaababaaaabaaab

5
 14
 42467327
 7
 7
 11
 0
 98718509
 813881762

import java.util.Scanner;

public class CString {

    public static final long MOD = (long)Math.pow(10,9) + 7l;
    private static Long[] cache;

    public static void main(String[] args) {
        Scanner scn = new Scanner(System.in);
        String s = scn.next();
        cache = new Long[s.length()+1];
        System.out.println(subs(0,s));

    }

    public static long subs(int i, String s) {
        if (cache[i] != null)
            return cache[i];

        if (i >= s.length())
            return 0;

        if (s.charAt(i) == 'a') {
            for (int x = i+1; x < s.length(); x++) {
                if (s.charAt(x) == 'b') {
                    cache[i] = ((1l + 2*subs(x+1, s))%MOD);
                    return cache[i];
                }
            }

            cache[i] = ((1l+subs(i+1,s))% MOD);
            return cache[i];
        }

        cache[i] = (subs(i+1, s)%MOD);
        return cache[i];
    }

}
