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 l[100005], r[100005];
int main() {
  string s, str = "";
  cin >> s;
  long long i = 0, cnt_a = 0;
  while (i < s.size()) {
    if (s[i] == 'a') {
      cnt_a++;
      str.append("a");
      i++;
    } else if (s[i] == 'b') {
      str.append("b");
      while (i < s.size() && s[i] == 'b') {
        i++;
      }
    } else
      i++;
  }
  long long cnt_left = 0, cnt_right = 0, ans = 0;
  for (long long i = 0, j = str.size() - 1; i < str.size(); i++, j--) {
    if (str[i] == 'b') {
      l[i] = cnt_left;
    } else {
      cnt_left++;
    }
    if (str[j] == 'b') {
      r[j] = cnt_right;
    } else
      cnt_right++;
  }
  for (long long i = 0; i < str.size(); i++) {
    if (str[i] == 'b') {
      ans = (ans + l[i] * r[i]) % 1000000007;
    }
  }
  cout << (ans + cnt_a) % 1000000007 << endl;
}
