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 void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		String st = sc.nextLine();
		int length = st.length();
		long ans[] = new long[length];
		int j = 0;
		char prevChar = 'A';
		while (j < length && st.charAt(j++) != 'a')
			;
		if (j < length) {
			prevChar = 'a';
		} else {
			System.out.println(0);
			return;
		}
		ans[j - 1] = 1;
		long countA = 0;
		long currentStart = 0;
		for (int i = j; i < length; i++) {
			if (prevChar == 'a') {
				if (st.charAt(i) == 'a') {
					ans[i] = (ans[i - 1] + (currentStart + 1) % 1000000007) % 1000000007;

				} else if (st.charAt(i) == 'b') {
					ans[i] = ans[i - 1];
					prevChar = 'b';
				} else {
					ans[i] = ans[i - 1];
				}
			} else if (prevChar == 'b') {
				if (st.charAt(i) == 'a') {
					currentStart = ans[i - 1];
					ans[i] = (((long) 2 * ans[i - 1]) % 1000000007 + 1) % 1000000007;
					prevChar = 'a';

				} else if (st.charAt(i) == 'b') {
					ans[i] = ans[i - 1];
				} else {
					ans[i] = ans[i - 1];
				}
			}
			///System.out.println(ans[i]);
		}
		System.out.println(ans[length - 1]);
	}

}