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 MOD = (long long)1e9 + 7ll;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s;
  cin >> s;
  int n = (int)s.length();
  vector<long long> dp(n, 0ll);
  vector<long long> sum(n, 0ll);
  int prev = 0;
  long long ans = 0ll;
  for (int i = 0; i < n; i++) {
    if (i > 0) {
      sum[i] = sum[i - 1];
    }
    if (s[i] == 'a') {
      dp[i] = 1ll;
      if (prev > 0) {
        dp[i] = (dp[i] + sum[prev - 1]) % MOD;
      }
    } else if (s[i] == 'b') {
      prev = i;
    }
    sum[i] = (sum[i] + dp[i]) % MOD;
    ans = (ans + dp[i]) % MOD;
  }
  cout << ans << '\n';
  return 0;
}
