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;
using pii = pair<int, int>;
using ll = long long;
string s;
vector<ll> dp;
vector<int> bsum;
ll answer = 0;
void input() { cin >> s; }
void output() { printf("%lld", answer); }
ll getSum(int pos) {
  ll ret = 0;
  pos += 1;
  while (pos > 0) {
    ret = (ret + dp[pos - 1]) % 100000007;
    pos -= pos & -pos;
  }
  return ret;
}
void updateDP(int pos, int value) {
  pos += 1;
  while (pos <= dp.size()) {
    dp[pos - 1] = (dp[pos - 1] + value) % 100000007;
    pos += pos & -pos;
  }
}
void process() {
  bool isFirst = true;
  int bcnt = 0;
  for (int i = s.length() - 1; i >= 0; i--) {
    if (s[i] == 'a') {
      if (isFirst) {
        isFirst = false;
        continue;
      }
      if (bsum.empty())
        bsum.push_back(bcnt);
      else
        bsum.push_back(bcnt + bsum.back());
      bcnt = 0;
    } else if (s[i] == 'b')
      bcnt += 1;
  }
  if (bsum.empty()) {
    if (isFirst)
      answer = 0;
    else
      answer = 1;
    return;
  }
  dp.resize(bsum.size() + 1);
  answer = 1;
  updateDP(0, 1);
  for (int i = 1; i < dp.size(); i++) {
    int idx =
        i - 1 - (upper_bound(bsum.end() - i, bsum.end(), 0) - (bsum.end() - i));
    int now_answer = 1;
    if (idx != -1) now_answer = (getSum(idx) + 1) % 100000007;
    updateDP(i, now_answer);
    answer = (answer + now_answer) % 100000007;
  }
}
int main() {
  input();
  process();
  output();
  return 0;
}
