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(void) {
  string input;
  cin >> input;
  vector<long long int> dp(input.size());
  int pre_a = -1;
  int last_a = -1;
  for (int i = 0; i < (int)input.size(); ++i)
    if (input[i] == 'a') {
      dp[i]++;
      if (pre_a != -1) dp[i] += dp[pre_a];
      if (i > 0 && input[i - 1] == 'b') {
        if (pre_a != -1) dp[i] += dp[pre_a];
      } else if (i > 0 && input[i - 1] != 'b') {
        if (last_a != -1) dp[i] += dp[last_a];
      }
      dp[i] %= 1000000007;
      last_a = i;
    } else if (input[i] == 'b')
      pre_a = last_a;
  if (last_a != -1)
    cout << dp[last_a] << endl;
  else
    cout << 0 << endl;
  return 0;
}
