aaaaabb
 aabaaaa
 babbabaabbbbabwbvbhbbbaaabbabbbbbbbkabbbbabaaabbbbbbajabbaaabazbbbzbalbabbwbbaabbabacabdbabbbfaaabbb
 baaahbbbba
 ababavvvv
 abnxabbaab
 krflnzhter
 amaabbbbxaabbbabaabaabbaaabaaaaabibbabaabaaabaabcaaxabablbbbbmbbbaaaaaabbaabbbaaabaaaababaababbabbbb
 babbbaaaaaabbbaabaaaaaoaabababaababaaaaababaaaaaaabbbbbbaaapaabaaabaaababaaaabaaaabaaaaababaaaabaaab

5
 14
 42467327
 7
 7
 11
 0
 98718509
 813881762

import java.util.*;
public class c{
    
    
    public static void main(String args[]) 
    { 
        Scanner sc=new Scanner(System.in);
        String ss=sc.next();
        int l=ss.length();
        int c=' ';
        int s=0;
        int ca=0;
        char bc='b';
        int k=1000000007;
        int tca=0;
        int tcb=0;
        int qqq=0;
        int abcd=0;
        for(int x=0;x<l;x++)
        {
            char ch=ss.charAt(x);
            if(ch=='a')
            {
                if(tcb==1)
                {
                    tcb=0;
                    bc='b';
                }
                tca++;
                s++;
                if(bc=='b')
                {
                    s+=ca;
                }
                else
                {
                    s+=qqq;
                }
            }
            else
            {
                if(tca!=0)
                {
                    abcd=tca;
                }
                if(ch=='b')
                {
                    tcb=1;
                    qqq+=abcd;
                    abcd=0;
                }
                bc=ch;
                ca+=tca;
                tca=0;
            }
            s%=k;
        }
        System.out.println(s%k);
    }
}

