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;
long long a[1005];
const long long mod = 1e9 + 7;
int main() {
  ios::sync_with_stdio(false);
  string s;
  cin >> s;
  long long numa = 0;
  long long numba = 0;
  long long numb = 0;
  long long ans = 0;
  long long l = s.size();
  int flag = 0;
  for (int i = 0; i < l; i++) {
    if (s[i] == 'a') {
      ans++;
      ans += numba * numb;
      ans %= mod;
      numa++;
      numa %= mod;
      flag = 1;
    } else if (s[i] == 'b') {
      numba = numa;
      numba %= mod;
      if (flag == 1) {
        numb++;
        numb %= mod;
        flag = 0;
      }
    }
  }
  cout << ans << endl;
}
