aaaaabb
 aabaaaa
 babbabaabbbbabwbvbhbbbaaabbabbbbbbbkabbbbabaaabbbbbbajabbaaabazbbbzbalbabbwbbaabbabacabdbabbbfaaabbb
 baaahbbbba
 ababavvvv
 abnxabbaab
 krflnzhter
 amaabbbbxaabbbabaabaabbaaabaaaaabibbabaabaaabaabcaaxabablbbbbmbbbaaaaaabbaabbbaaabaaaababaababbabbbb
 babbbaaaaaabbbaabaaaaaoaabababaababaaaaababaaaaaaabbbbbbaaapaabaaabaaababaaaabaaaabaaaaababaaaabaaab

5
 14
 42467327
 7
 7
 11
 0
 98718509
 813881762

import java.util.Scanner;

public class Main {

    public static final long  MOD = 1000000007L;

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        long[] dp = new long[100005];
        while (scanner.hasNext()) {
            String input = scanner.nextLine();
            int lastBucket = -1, lastA = -1;
            long ans = 0L;
            for (int i = 0; i < input.length(); i ++)
            {
                dp[i] = 0;
                if (input.charAt(i) == 'a') {
                    if (lastBucket < 0) {
                        dp[i] = i == 0 ? 1 : dp[i-1] + 1;
                    } else {
                        dp[i] = dp[lastBucket] + 1 + dp[i-1];
                    }
                    dp[i] = dp[i] % MOD;
                    lastA = i;
                } else if(input.charAt(i) == 'b') {
                    if (lastBucket != lastA) {
                        lastBucket = lastA;
                    }
                    dp[i] = i == 0 ? 0: dp[i-1];
                } else {
                    dp[i] = i == 0 ? 0: dp[i-1];
                }
            }
            System.out.println(dp[input.length()-1]);
        }
    }
}
