aaaaabb
 aabaaaa
 babbabaabbbbabwbvbhbbbaaabbabbbbbbbkabbbbabaaabbbbbbajabbaaabazbbbzbalbabbwbbaabbabacabdbabbbfaaabbb
 baaahbbbba
 ababavvvv
 abnxabbaab
 krflnzhter
 amaabbbbxaabbbabaabaabbaaabaaaaabibbabaabaaabaabcaaxabablbbbbmbbbaaaaaabbaabbbaaabaaaababaababbabbbb
 babbbaaaaaabbbaabaaaaaoaabababaababaaaaababaaaaaaabbbbbbaaapaabaaabaaababaaaabaaaabaaaaababaaaabaaab

5
 14
 42467327
 7
 7
 11
 0
 98718509
 813881762

#include <bits/stdc++.h>
const long long k = 1e9 + 7;
using namespace std;
string str;
vector<int> v;
int main() {
  cin >> str;
  int num = 0;
  bool f = 1;
  for (int i = 0; i < str.size(); i++) {
    if (str[i] == 'a') {
      num++;
      f = 1;
    }
    if (str[i] == 'b' && f) {
      v.push_back(num);
      f = 0;
    }
  }
  long long ans = num;
  int d = 0;
  for (int i = 0; i < v.size(); i++) {
    ans += (long long)(v[i] - d) * (num - v[i]);
    d = v[i];
    ans %= k;
  }
  cout << ans << endl;
}
