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;
long long int power(long long int base, long long int expo) {
  long long int res = 1;
  while (expo > 0) {
    if (expo % 2 == 1) res = (res * base) % 1000000007;
    expo = expo / 2;
    base = (base * base) % 1000000007;
  }
  return res;
}
int main() {
  string s;
  cin >> s;
  if (s.length() == 0) {
    cout << 0;
    return 0;
  } else if (s.length() == 1) {
    cout << (s[0] == 'a');
    return 0;
  } else if (s.length() == 2) {
    cout << ((s[0] == 'a') + (s[1] == 'a'));
    return 0;
  }
  vector<int> posa;
  vector<int> posb;
  posb.push_back(0);
  for (int i = 0; i < s.length(); i++) {
    if (s[i] == 'a')
      posa.push_back(i + 1);
    else if (s[i] == 'b')
      posb.push_back(i + 1);
  }
  if (posa.size() == 0) {
    cout << 0;
    return 0;
  } else if (posa.size() == 1) {
    cout << 1;
    return 0;
  } else if (posb.size() == 1) {
    cout << posa.size();
    return 0;
  }
  posb.push_back(s.length() + 1);
  s = "b" + s + "b";
  int n = s.length();
  vector<int> num_bw_b;
  int j = 0;
  for (j = 1; j < posb.size(); j++) {
    int sum = 0;
    for (int i = posb[j - 1]; i < posb[j]; i++) {
      sum += (s[i] == 'a');
    }
    num_bw_b.push_back(sum);
  }
  int numA = posa.size();
  int tillA = 0;
  long long int ans = 0;
  for (int i = 0; i < num_bw_b.size() - 1; i++) {
    tillA += num_bw_b[i];
    ans = (ans + ((num_bw_b[i] * (num_bw_b.size() - 1 - i)) % 1000000007)) %
          1000000007;
  }
  ans = (ans + numA) % 1000000007;
  cout << ans << endl;
  return 0;
}
