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;
string s;
long long ans = 0;
void solve(int l, int r) {
  vector<int> cnt;
  int x = 0;
  for (int i = l; i < r; i++) {
    if (s[i] == 'a')
      x++;
    else {
      if (x) cnt.push_back(x);
      x = 0;
    }
  }
  cnt.push_back(x);
  long long sum = 0;
  vector<int> temp(cnt.size());
  auto it = temp.rbegin(), itr = cnt.rbegin();
  while (it != temp.rend()) {
    sum += *itr;
    *it = sum;
    itr++;
    it++;
  }
  long long val = 0;
  ans = (ans + sum);
  ans %= 1000 * 1000 * 1000 + 7;
  for (int i = 0; i < temp.size() - 1; i++) {
    val = cnt[i] * temp[i + 1];
    ans += val;
    ans %= 1000 * 1000 * 1000 + 7;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  cin >> s;
  int l = 0, r = 0;
  while (r < s.size()) {
    if (s[r] == 'a' || (s[l] == 'a' && s[r] == 'b'))
      r++;
    else {
      if (s[l] == 'a') solve(l, r);
      r++;
      l = r;
    }
  }
  if (s[l] == 'a') solve(l, r);
  cout << ans << "\n";
}
