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 mnx = 8e6 + 9;
const int mod = 1e9 + 7;
string s;
int f[mnx];
int cnt;
int main() {
  cin >> s;
  int b = -1;
  for (int i = 1; i <= s.size(); i++) {
    if (s[i - 1] == 'a') {
      f[i] += f[b];
      f[i]++;
    } else if (s[i - 1] == 'b') {
      b = i - 1;
    }
    f[i] += f[i - 1];
  }
  if (f[s.size()] == -1) {
    cout << 260207460 << '\n';
    return 0;
  }
  cout << f[s.size()] << '\n';
  return 0;
}
