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() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  string str;
  cin >> str;
  int n = str.length();
  vector<int> l(n, 0);
  vector<int> r(n, 0);
  int temp = 0;
  if (str[0] == 'a') temp = 1;
  for (int i = 1; i < n; i++) {
    l[i] = temp;
    if (str[i] == 'a') temp++;
  }
  if (str[n - 1] == 'a') temp = 1;
  for (int i = n - 2; i >= 0; i--) {
    r[i] = temp;
    if (str[i] == 'a') temp++;
  }
  long long ans = 0;
  for (int i = 0; i < n; i++)
    if (str[i] == 'a') ans++;
  int flag = 1;
  for (int i = 1; i < n - 1; i++) {
    if (str[i] == 'b' and flag) {
      long long x = (l[i] * r[i]) % 1000000007;
      ans = (ans + x) % 1000000007;
      flag = 0;
    }
    if (str[i] == 'a') flag = 1;
  }
  cout << ans << endl;
}
