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() {
  string str;
  cin >> str;
  long long mina = -1, maxa = -1, count = 0, maxb, minb, countx = 0;
  for (int i = 0; i < str.length(); i++) {
    if (str[i] == 'a') {
      countx++;
    }
  }
  if (countx == 0) {
    cout << "0" << endl;
    return 0;
  }
  for (int i = 0; i < str.length(); i++) {
    if (str[i] == 'a') {
      minb = i;
      break;
    }
  }
  for (int i = str.length() - 1; i >= 0; i--) {
    if (str[i] == 'a') {
      maxb = i;
      break;
    }
  }
  for (int i = minb; i <= maxb; i++) {
    if (str[i] == 'b') {
      mina = i;
      break;
    }
    if (str[i] == 'a') {
      count++;
    }
  }
  for (int i = str.length() - 1; i >= 0; i--) {
    if (str[i] == 'b') {
      maxa = i;
      break;
    }
  }
  if (mina == -1) {
    cout << count << endl;
    return 0;
  }
  long long counta = 0, countb = 0;
  for (int i = minb; i <= mina; i++) {
    if (str[i] == 'a') {
      counta++;
    }
  }
  for (int i = maxa; i <= maxb; i++) {
    if (str[i] == 'a') {
      countb++;
    }
  }
  maxa++;
  mina++;
  cout << (counta * countb + counta + countb) % 1000000007;
}
