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() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  string s;
  cin >> s;
  long long n = s.size();
  long long p = -1;
  vector<long long> ans(n, 0);
  if (s[0] == 'a')
    ans[0] = 1;
  else
    p = 0;
  for (long long i = 1; i < n; i++) {
    ans[i] += (ans[i - 1]) % 1000000007;
    ans[i] = ans[i] % 1000000007;
    if (s[i] == 'a') {
      ans[i]++;
    }
    if (p != -1 && s[i] == 'a') ans[i] += (ans[p]) % 1000000007;
    ans[i] = (ans[i] + 1000000007) % 1000000007;
    if (s[i] == 'b') p = i;
  }
  cout << ans[n - 1] % 1000000007 << endl;
}
