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;
int main() {
  int n;
  string s;
  cin >> s;
  n = s.length();
  vector<long long> dp(n);
  dp[0] = (s[0] == 'a' ? 1 : 0);
  int last_b = (s[0] == 'b' ? 0 : -1);
  for (int i = 1; i < s.length(); i++) {
    dp[i] = dp[i - 1];
    if (s[i] == 'b') {
      last_b = i;
      continue;
    }
    if (s[i] == 'a') dp[i]++;
    if (last_b == -1) continue;
    dp[i] = (dp[i] + dp[last_b]) % 1000000007;
  }
  cout << dp[n - 1];
  return 0;
}
