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;
const double pi = acos(-1);
const double eps = 1e6 - 9;
const long long mod = 1e9 + 7;
const long long inf = (1ll << 60);
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0), cout.precision(15);
  long long l, pos = 0, res = 0;
  string s, aux = "";
  cin >> s;
  l = (int)(s).size();
  vector<int> v;
  v.push_back(0);
  for (int i = +1 > 0 ? 0 : l - 1; 0 <= i && i <= l - 1; i += +1) {
    if (s[i] == 'a' and aux.back() == 'b') {
      v.push_back(0);
      pos++;
    }
    if (s[i] == 'a') {
      aux += s[i];
      v[pos]++;
    }
    if (s[i] == 'b' and aux.back() != 'b') {
      aux += s[i];
    }
  }
  for (int i = +1 > 0 ? 0 : (int)(v).size() - 1;
       0 <= i && i <= (int)(v).size() - 1; i += +1) {
    res += v[i];
    res %= mod;
    for (int j = 1 > 0 ? i + 1 : (int)(v).size() - 1;
         i + 1 <= j && j <= (int)(v).size() - 1; j += 1) {
      res += (v[i] * v[j]) % mod;
      res %= mod;
    }
  }
  cout << res << '\n';
  return 0;
}
