aaaaabb
 aabaaaa
 babbabaabbbbabwbvbhbbbaaabbabbbbbbbkabbbbabaaabbbbbbajabbaaabazbbbzbalbabbwbbaabbabacabdbabbbfaaabbb
 baaahbbbba
 ababavvvv
 abnxabbaab
 krflnzhter
 amaabbbbxaabbbabaabaabbaaabaaaaabibbabaabaaabaabcaaxabablbbbbmbbbaaaaaabbaabbbaaabaaaababaababbabbbb
 babbbaaaaaabbbaabaaaaaoaabababaababaaaaababaaaaaaabbbbbbaaapaabaaabaaababaaaabaaaabaaaaababaaaabaaab

5
 14
 42467327
 7
 7
 11
 0
 98718509
 813881762

import java.util.*;
import java.io.*;
import java.lang.*;
public class fair{
   public static void main(String[] arg) throws IOException {
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));    
      PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));   
      String s = br.readLine();
      long count = 0;
      for(int k = 0; k < s.length(); k++){
         char temp = s.charAt(k);
         if(temp == 'a'){
            count++;
            int val = 0;
            if(k == s.length()-1){
               break;
            }
            else if (s.charAt(k+1) == 'b'){
               int x = k+1;
               while((x< s.length()) && (s.charAt(x) == 'b' || s.charAt(x) == 'a')){
                  if(s.charAt(x) == 'b'){
                     x++;
                  }
                  else{
                     count++;
                     x++;
                  }
               }
            }
         }
      }
      count = count % 10000000;
      out.println(count);
      out.close();
   }
}