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 long long N = 1e5 + 7;
const long long mod = 1e9 + 7;
long long dp[N][2];
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  string s;
  cin >> s;
  long long n = s.length();
  dp[0][0] = (s[0] == 'a' ? 1 : 0);
  for (long long i = 0; i < n; i++) dp[i][1] = -1;
  dp[0][1] = (s[0] == 'b' ? 0 : -1);
  for (long long i = 1; i < n; i++) {
    dp[i][0] = dp[i - 1][0];
    dp[i][1] = dp[i - 1][1];
    if (s[i] == 'a') {
      if (dp[i - 1][1] != -1) {
        long long j = dp[i - 1][1];
        if (j != 0) dp[i][0] += dp[j - 1][0];
      }
      dp[i][0] += 1;
    }
    if (s[i] == 'b') {
      dp[i][1] = i;
    }
    dp[i][0] %= mod;
  }
  cout << dp[n - 1][0];
  return 0;
}
