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 int power(long long int x, long long int y);
long long int gcd(long long int a, long long int b);
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  string s;
  cin >> s;
  long long int n = ((long long int)(s).size());
  vector<long long int> v;
  long long int f = 0, cnt = 0, cnt1 = 0, cnt2 = 0, cnt3 = 0, pp = 0, p = 0;
  for (long long int i = n; i >= 0; i--) {
    if (s[i] == 'a') {
      if (f == 1) {
        long long int temp = (p * cnt2) % 1000000007;
        temp = (temp + cnt1) % 1000000007;
        v.push_back(temp);
        pp = temp;
      }
      cnt3++;
      cnt++;
    } else if (s[i] == 'b') {
      f = 1;
      cnt1 = cnt;
      cnt2 = cnt3;
      cnt3 = 0;
      p = pp;
    }
  }
  for (auto i : v) cnt = (cnt + i) % 1000000007;
  cout << cnt << "\n";
}
long long int power(long long int x, long long int y) {
  long long int res = 1;
  x %= 1000000007;
  while (y > 0) {
    if (y & 1) res = (res * x) % 1000000007;
    y = y >> 1;
    x = (x * x) % 1000000007;
  }
  return res % 1000000007;
}
long long int gcd(long long int a, long long int b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
