#include <bits/stdc++.h>
using namespace std;
long long mod = 1e9 + 7;
int type_a = 1, type_b = 2;
string s;
vector<pair<int, long long> > vec;
int main() {
  cin >> s;
  int len = s.size();
  int vec_size = 0;
  for (int i = 0; i < len; i++) {
    int type = (s[i] == 'a') ? type_a : type_b;
    if (vec.size() > 0 && vec[vec_size - 1].first == type) {
      vec[vec_size - 1].second++;
    } else {
      vec.push_back(make_pair(type, 1LL));
      vec_size++;
    }
  }
  long long ans = 0;
  long long b_count = 0;
  int i = vec.size() - 1;
  for (; i >= 0; i--) {
    if (vec[i].first == type_a) {
      int x = vec[i].second;
      while (x--) {
        ans += b_count;
        b_count = (b_count << 1);
        if (ans >= mod) ans = ans % mod;
        if (b_count >= mod) b_count %= mod;
      }
    } else {
      b_count += vec[i].second;
      if (b_count >= mod) b_count %= mod;
    }
  }
  cout << ans << endl;
  return 0;
}
