aaaaabb
 aabaaaa
 babbabaabbbbabwbvbhbbbaaabbabbbbbbbkabbbbabaaabbbbbbajabbaaabazbbbzbalbabbwbbaabbabacabdbabbbfaaabbb
 baaahbbbba
 ababavvvv
 abnxabbaab
 krflnzhter
 amaabbbbxaabbbabaabaabbaaabaaaaabibbabaabaaabaabcaaxabablbbbbmbbbaaaaaabbaabbbaaabaaaababaababbabbbb
 babbbaaaaaabbbaabaaaaaoaabababaababaaaaababaaaaaaabbbbbbaaapaabaaabaaababaaaabaaaabaaaaababaaaabaaab

5
 14
 42467327
 7
 7
 11
 0
 98718509
 813881762

//package dec18;

import java.util.Scanner;

public class FairNutString1084C {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scn=new Scanner(System.in);
		String str=scn.next();
		long ans=0;
		long MOD = 1000000000+7;
		for(int i=0; i<=str.length()-1; i++)
		{
			if(str.charAt(i)=='a')
			{
				ans=(ans%MOD+1)%MOD;
			}
			if(i>0 && i<str.length()-1 && str.charAt(i)=='b' && str.charAt(str.length()-1)=='a')
			{
				ans=(ans%MOD+1)%MOD;
			}
		}
		System.out.println(ans);
		

	}

}
