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;
int main() {
  string s;
  cin >> s;
  int n = s.length();
  int ans = 0;
  int mod = 1000000007;
  for (int i = 0; i < n; i++) {
    if (s[i] == 'a') {
      ans = (ans + 1) % mod;
    }
  }
  for (int i = 0; i < n - 1; i++) {
    if (s[i] == 'a') {
      int f = 0;
      for (int j = i + 1; j < n; j++) {
        if (s[j] == 'b') {
          f = 1;
        }
        if ((s[j] == 'a') && f == 1) {
          ans = (ans + 1) % mod;
        }
      }
    }
  }
  cout << ans;
  return 0;
}
