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 = 2e5 + 5;
const long long mod = 1e9 + 7;
struct st {
  long long ans;
  long long lst;
  long long cnt;
};
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long i = 0;
  vector<long long> v;
  long long n, a;
  string str2, str;
  cin >> str2;
  for (i = 0; i < str2.size(); i++) {
    if (str2[i] == 'a' || str2[i] == 'b') str += str2[i];
  }
  n = str.size();
  st dp[N];
  if (str[0] == 'a') {
    dp[0].ans = 1;
    dp[0].lst = 1;
    dp[0].cnt = 1;
  } else {
    dp[0].ans = 0;
    dp[0].lst = 2;
    dp[0].cnt = 1;
  }
  for (i = 1; i < n; i++) {
    if (dp[i - 1].lst == 2 && str[i] == 'a') {
      dp[i].ans = (2 * dp[i - 1].ans + 1) % mod;
      dp[i].lst = 1;
      dp[i].cnt = 1;
    } else if (dp[i - 1].lst == 1 && str[i] == 'b') {
      dp[i].ans = dp[i - 1].ans;
      dp[i].lst = 2;
      dp[i].cnt = 1;
    } else if (dp[i - 1].lst == 1 && str[i] == 'a') {
      long long idx = i - dp[i - 1].cnt - 1;
      dp[i].ans = dp[i - 1].ans + 1;
      if (idx >= 0) dp[i].ans += dp[idx].ans;
      dp[i].lst = 1;
      dp[i].cnt = dp[i - 1].cnt + 1;
    } else {
      dp[i].ans = dp[i - 1].ans;
      dp[i].lst = 2;
      dp[i].cnt = dp[i - 1].cnt + 1;
    }
  }
  cout << dp[n - 1].ans % mod;
}
