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;
long long MOD = 1000000000 + 7;
int main() {
  string str;
  cin >> str;
  long long ans = 0;
  for (int i = 0; i < str.size(); i++) {
    ans += (str[i] == 'a');
  }
  long long cnt1 = 0, cnt2 = 0;
  bool flag = 0;
  for (int i = 0; i < str.size(); i++) {
    if (str[i] == 'a') {
      if (!flag)
        cnt1++;
      else
        cnt2++;
    } else if (str[i] == 'b') {
      if (flag) {
        ans = (ans % MOD + ((cnt1 % MOD) * (cnt2 % MOD)) % MOD) % MOD;
        cnt1 = (cnt1 + cnt2 + cnt1 * cnt2);
        cnt2 = 0;
      } else {
        flag = 1;
      }
    }
  }
  if (flag) {
    ans = (ans % MOD + ((cnt1 % MOD) * (cnt2 % MOD)) % MOD) % MOD;
  }
  cout << ans % MOD << endl;
}
