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;
void solve() {
  string s;
  cin >> s;
  vector<long long> dp(s.size());
  int prevb = -1;
  int preva = -1;
  int prevva = -1;
  long long pos = 1;
  int n = s.size();
  vector<long long> apos(n + 1);
  vector<long long> pr(n + 1);
  for (int i = 0; i < s.size(); ++i) {
    if (s[i] == 'a') {
      if (prevb != -1 && preva != -1 && preva < prevb) {
        dp[i] = dp[preva] * 2 + 1;
        pos++;
        apos[pos] += apos[pos - 1];
        prevva = preva;
      } else if (preva != -1) {
        dp[i] = dp[preva] + 1;
        if (prevva != -1) dp[i] += dp[prevva];
      } else
        dp[i] = 1;
      apos[pos]++;
      preva = i;
    }
    if (s[i] == 'b') prevb = i;
  }
  long long res = 0;
  for (int i = 0; i < n; ++i) {
    if (dp[i]) res = dp[i];
  }
  cout << res % (long long)(1e9 + 7);
}
int main() {
  ios_base::sync_with_stdio(false);
  solve();
  return 0;
}
