aaaaabb
 aabaaaa
 babbabaabbbbabwbvbhbbbaaabbabbbbbbbkabbbbabaaabbbbbbajabbaaabazbbbzbalbabbwbbaabbabacabdbabbbfaaabbb
 baaahbbbba
 ababavvvv
 abnxabbaab
 krflnzhter
 amaabbbbxaabbbabaabaabbaaabaaaaabibbabaabaaabaabcaaxabablbbbbmbbbaaaaaabbaabbbaaabaaaababaababbabbbb
 babbbaaaaaabbbaabaaaaaoaabababaababaaaaababaaaaaaabbbbbbaaapaabaaabaaababaaaabaaaabaaaaababaaaabaaab

5
 14
 42467327
 7
 7
 11
 0
 98718509
 813881762

#include <bits/stdc++.h>
int MOD = 1e9 + 7;
using namespace std;
string s;
int main() {
  std::ios::sync_with_stdio(false);
  cin >> s;
  long long ans = 0;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == 'a')
      ans++;
    else if (s[i] == 'b') {
      int flag = 0;
      for (int j = 0; j < i; j++)
        if (s[j] == 'a') {
          flag++;
          break;
        }
      for (int j = i + 1; j < s.size() - 1; j++)
        if (s[j] == 'a') {
          flag++;
          break;
        }
      if (flag == 2) ans++;
    }
  }
  printf("%lld\n", ans % MOD);
  return 0;
}
