aaaaabb
 aabaaaa
 babbabaabbbbabwbvbhbbbaaabbabbbbbbbkabbbbabaaabbbbbbajabbaaabazbbbzbalbabbwbbaabbabacabdbabbbfaaabbb
 baaahbbbba
 ababavvvv
 abnxabbaab
 krflnzhter
 amaabbbbxaabbbabaabaabbaaabaaaaabibbabaabaaabaabcaaxabablbbbbmbbbaaaaaabbaabbbaaabaaaababaababbabbbb
 babbbaaaaaabbbaabaaaaaoaabababaababaaaaababaaaaaaabbbbbbaaapaabaaabaaababaaaabaaaabaaaaababaaaabaaab

5
 14
 42467327
 7
 7
 11
 0
 98718509
 813881762

import java.util.Scanner;

public class B {
	
	public static void main(String[] args) {
		
		Scanner scn = new Scanner(System.in);
		String s = scn.nextLine();
		long sequences = 0, AsAfterLastB = 0, store;
		boolean b = false;
		
		for (int i = 0; i < s.length(); i++) {
			if (s.charAt(i) == 'a') {
				if (b) {
					b = false;
					AsAfterLastB = sequences;
					sequences *= 2;
				} else {
					store = sequences - AsAfterLastB;
					sequences += store;
					AsAfterLastB += store;
				}
				sequences++;
				AsAfterLastB++;
			} else if (s.charAt(i) == 'b') {
				b = true;
				AsAfterLastB = 0;
			}
		}
		
		System.out.println(sequences % 1000000007);
		scn.close();
	}
}