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;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int M = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  string s;
  cin >> s;
  int N = ((int)(s).size());
  vector<int> DP(N + 1, 0);
  int lastA = 0, lastAB = 0;
  long long ans = 0;
  for (int i = 1; i <= N; i++) {
    if (s[i - 1] == 'a') {
      ans = (ans + DP[lastAB] + 1) % M;
      lastA = i;
    }
    if (s[i - 1] == 'b') {
      lastAB = lastA;
    }
    DP[i] = ans;
  }
  cout << DP[N];
}
