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;
long long int P = 1e9 + 7;
void solve() {
  long long int i, j, k, l, m, n, o;
  string second;
  cin >> second;
  second = '#' + second;
  n = second.length();
  vector<long long int> dp(n), v(n);
  long long int lasta = 0, lastb = 0;
  for (i = 1; i < n; i++) {
    v[i] = v[i - 1];
    if (second[i] == 'a') {
      v[i] = i;
      dp[i] = (1 + dp[lasta]) % P;
      dp[i] = (dp[i] + dp[v[lastb]]) % P;
      lasta = i;
    }
    if (second[i] == 'b') {
      lastb = i;
    }
  }
  cout << dp[lasta] << "\n";
}
int main() {
  long long int t = 1;
  long long int i = 1;
  while (t--) {
    i++;
    solve();
  }
  return 0;
}
