#include <bits/stdc++.h>
using namespace std;
const long long N = 1000005;
const long long mod = 1000000007;
vector<long long> v, b;
long long n, maxn;
long long tree[N];
long long get(long long indx) {
  long long sum = 0ll;
  while (indx > 0ll) {
    sum += tree[indx];
    sum %= mod;
    indx -= indx & -indx;
  }
  return sum % mod;
}
void update(long long indx, long long k) {
  while (indx <= maxn) {
    tree[indx] += k;
    tree[indx] %= mod;
    indx += indx & -indx;
  }
  return;
}
long long last_b_er_ager_indx(long long indx) {
  long long k = lower_bound(b.begin(), b.end(), indx) - b.begin();
  return b[k - 1];
}
int32_t main() {
  string s;
  cin >> s;
  v.push_back(-1);
  b.push_back(-1);
  maxn = s.size() + 10;
  for (long long i = 0; i < s.size(); i++) {
    if (s[i] == 'a') {
      v.push_back(i + 1);
    } else if (s[i] == 'b')
      b.push_back(i + 1);
  }
  n = v.size() - 1;
  long long sum = 0;
  for (long long i = 1; i <= n; i++) {
    long long mama = last_b_er_ager_indx(v[i]);
    long long k = get(mama) + 1;
    k %= mod;
    update(v[i], k);
    sum += k;
    sum %= mod;
  }
  cout << sum % mod << endl;
  return 0;
}
