aaaaabb
 aabaaaa
 babbabaabbbbabwbvbhbbbaaabbabbbbbbbkabbbbabaaabbbbbbajabbaaabazbbbzbalbabbwbbaabbabacabdbabbbfaaabbb
 baaahbbbba
 ababavvvv
 abnxabbaab
 krflnzhter
 amaabbbbxaabbbabaabaabbaaabaaaaabibbabaabaaabaabcaaxabablbbbbmbbbaaaaaabbaabbbaaabaaaababaababbabbbb
 babbbaaaaaabbbaabaaaaaoaabababaababaaaaababaaaaaaabbbbbbaaapaabaaabaaababaaaabaaaabaaaaababaaaabaaab

5
 14
 42467327
 7
 7
 11
 0
 98718509
 813881762



#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
const ll mod = 1e9 + 7;

vector <ll> b;

int main() {
    ios_base::sync_with_stdio(0); 
    string s;
    cin >> s;
    ll n = s.length();
    for (ll i = 0; i < n; i++) if(s[i] == 'b') b.push_back(i);
    ll d[n] = {0};
    
    for (ll i = 0; i < n; i++) {
        if(s[i] == 'a') d[i] = 1;
    }
    for(ll i = 1; i < n; i++) {
        if(s[i] == 'a') {
            ll t = upper_bound(b.begin(), b.end(), i) - b.begin();
            if(t) {
                t = b[t - 1];
                //cout << i << ' '  << t << endl;
                d[i] += d[t];
                d[i] %= mod;
            }
        }
        d[i] += d[i - 1];
    }
    //for (ll i = 0; i < n; i++) cout << d[i] << ' ' ; cout << endl;
    cout << d[n - 1];
    
    
}