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;
  for (int i = 0; i < str.length(); 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;
  }
  maxa++;
  mina++;
  cout << ((mina - 1) * (str.length() - maxa) + (mina - 1) +
           (str.length() - maxa)) %
              1000000007;
}
