aaaaabb
 aabaaaa
 babbabaabbbbabwbvbhbbbaaabbabbbbbbbkabbbbabaaabbbbbbajabbaaabazbbbzbalbabbwbbaabbabacabdbabbbfaaabbb
 baaahbbbba
 ababavvvv
 abnxabbaab
 krflnzhter
 amaabbbbxaabbbabaabaabbaaabaaaaabibbabaabaaabaabcaaxabablbbbbmbbbaaaaaabbaabbbaaabaaaababaababbabbbb
 babbbaaaaaabbbaabaaaaaoaabababaababaaaaababaaaaaaabbbbbbaaapaabaaabaaababaaaabaaaabaaaaababaaaabaaab

5
 14
 42467327
 7
 7
 11
 0
 98718509
 813881762

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.BitSet;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Set;
import java.util.StringTokenizer;

public class q6 {

	 public static int gcd(int a,int b) {
		 if(b==0) return a;
		 else return gcd(b,a%b);
	 }
	 
	 static long power(long x, long y, long p) 
	    { 
	        // Initialize result 
	        long res = 1;      
	         
	        // Update x if it is more   
	        // than or equal to p 
	        x = x % p;  
	      
	        while (y > 0) 
	        { 
	            // If y is odd, multiply x 
	            // with result 
	            if((y & 1)==1) 
	                res = (res * x) % p; 
	      
	            // y must be even now 
	            // y = y / 2 
	            y = y >> 1;  
	            x = (x * x) % p;  
	        } 
	        return res; 
	    } 
	 
	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		Reader.init(System.in);
		String s=Reader.next();
		int n=s.length();
		long ans=0;
		long mod=1000000007;
		int[] arr=new int[n];
		int index=-1;
		boolean bf=false;
		for(int i=0;i<n;i++) {
			if(s.charAt(i)=='b') {
				bf=true;
			}
			else if(s.charAt(i)=='a') {
				if(bf) {
					arr[i]=index;
				}
				else {
					if(index!=-1) {
						if(arr[index]==-1) {
							arr[i]=-1;
						}
						else arr[i]=arr[index];
					}
					else {
						arr[i]=-1;
					}
				}
				index=i;
				bf=false;
			}
		}
		long[][] possible=new long[n][2];
		int id2=-1;
		for(int i=0;i<n;i++) {
			if(s.charAt(i)=='a') {
				if(arr[i]==-1) {
					if(id2==-1) {
						possible[i][0]=0;
						possible[i][1]=1;
						ans=1;
					}
					else {
						possible[i][0]=possible[id2][0]+possible[id2][1];
						possible[i][0]%=mod;
						possible[i][1]=1;
						ans=possible[i][0]+possible[i][1];
						ans%=mod;
					}
				}
				else {
					if(arr[i]==id2) {
						possible[i][0]=possible[id2][0]+possible[id2][1];
						possible[i][0]%=mod;
						possible[i][1]=(possible[id2][0]+possible[id2][1])+1;
						possible[i][1]%=mod;
						ans=possible[i][0]+possible[i][1];
						ans%=mod;
					}
					else {
						possible[i][0]=possible[id2][0]+possible[id2][1];
						possible[i][0]%=mod;
						possible[i][1]=(possible[arr[i]][0]+possible[arr[i]][1])+1;
						possible[i][1]%=mod;
						ans=possible[i][0]+possible[i][1];
						ans%=mod;
					}
				}
				id2=i;
			}
		}
		System.out.println(ans);
		
		
		
	}
}
 class NOON{
	 String key;
	 NOON(int a, int b, int c){
		 int min,mid,max;
		 min=Math.min(a, Math.min(b, c));
		 max=Math.max(a,Math.max(b, c));
		 if(a!=min && a!=max) {
			 mid=a;
		 }
		 else if(b!=min && b!=max) {
			 mid=b;
		 }
		 else mid=c;
		 key=Integer.toString(min)+",,"+mid+",,"+max;
	 }
	 
	 
	 @Override
	 public boolean equals(Object o) {
		 if(o!=null && o.getClass()==this.getClass()) {
			 NOON val=(NOON) o;
			 return this.key.equals(val.key);
		 }
		 else return false;
	 }
	 
	 @Override
	 public int hashCode() {
		 return key.hashCode();
	 }
 }
 
 
 class Reader {
	    static BufferedReader reader;
	    static StringTokenizer tokenizer;
	 
	    /** call this method to initialize reader for InputStream */
	    static void init(InputStream input) {
	        reader = new BufferedReader(
	                     new InputStreamReader(input) );
	        tokenizer = new StringTokenizer("");
	    }
	 
	    /** get next word */
	    
	    static String next() throws IOException {
	        while ( ! tokenizer.hasMoreTokens() ) {
	            //TODO add check for eof if necessary
	            tokenizer = new StringTokenizer(
	                   reader.readLine() );
	        }
	        return tokenizer.nextToken();
	    }
	 
	    static int nextInt() throws IOException {
	        return Integer.parseInt( next() );
	    }
	    static long nextLong() throws IOException {
	        return Long.parseLong( next() );
	    }
	    static double nextDouble() throws IOException {
	        return Double.parseDouble( next() );
	    }
	}