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 = 100005;
const int mod = 1000000007;
long long n, p, q;
long long ans, cnt;
char s[maxn];
int main() {
  int i, j;
  int len;
  std::ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  while (cin >> s) {
    n = strlen(s);
    ans = q = p = i = 0;
    while (i < n) {
      if (s[i] == 'a') {
        p++;
        ans++;
        i++;
      } else if (s[i] == 'b') {
        while (s[i] == 'b' && i < n) i++;
        if (i < n && s[i] == 'a') {
          q = p;
          p = 0;
          while (s[i] == 'a' && i < n) {
            ans++;
            p++;
            i++;
          }
          ans += (p % mod) * (q % mod) % mod;
        }
      } else {
        p = q = 0;
        i++;
      }
      ans = ans % mod;
    }
    memset(s, 0, sizeof(s));
    cout << ans << endl;
  }
  return 0;
}
