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;
const int maxn = 100001, mod = 1000000007;
char s[maxn];
int b[maxn] = {}, n = 0;
int main() {
  scanf("%s", s);
  long long ans = 0, a;
  for (int i = 0; s[i]; i++) {
    if (s[i] == 'a') {
      ans++;
      b[n]++;
    } else if (s[i] == 'b' && b[n])
      n++;
  }
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j <= n; j++) ans += b[i] * b[j];
    ans %= mod;
  }
  long long add = b[0];
  if (b[2])
    for (int i = 1; i <= n; i++)
      if (b[i]) add *= b[i];
  ans += add;
  printf("%lld\n", ans % mod);
  return 0;
}
