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_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int MD = 1e9 + 7;
  int n;
  string s;
  cin >> s;
  n = s.size();
  int a1 = 0, b1 = 0, ans = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == 'a') {
      a1++;
      a1 %= MD;
      ans++;
      ans %= MD;
      ans += b1;
      ans %= MD;
    } else if (s[i] == 'b') {
      if (i == 0)
        b1 += a1;
      else if (s[i - 1] != 'b')
        b1 += a1;
      b1 %= MD;
    }
  }
  cout << ans;
  return 0;
}
