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 int maxn = 2e5 + 10;
const int mod = 1e9 + 7;
int n, m, k, d;
long long a[maxn], b[maxn];
vector<int> va, vb;
int main() {
  string str;
  cin >> str;
  str = " " + str;
  long long cnt = 0;
  for (int i = 1; i < str.size(); i++)
    if (str[i] == 'b') vb.push_back(i);
  for (int i = 1; i < str.size(); i++) {
    if (str[i] == 'a') {
      va.push_back(i), cnt++;
      if (va.size() < 2) continue;
      int r = upper_bound(vb.begin(), vb.end(), i) - vb.begin() - 1;
      if (r < 0) continue;
      int l = upper_bound(va.begin(), va.end(), vb[r]) - va.begin() - 1;
      if (l < 0) continue;
      cnt += va[l];
      cnt %= mod;
    }
  }
  cout << cnt % mod << endl;
  return 0;
}
