#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const long long base = 31;
int xx[4] = {0, 0, 1, -1};
int yy[4] = {-1, 1, 0, 0};
string step = "URDL";
long long Pow(long long a, long long b) {
  long long res = 1;
  if (b <= 0) return 1;
  while (b > 0) {
    if (b % 2) {
      res = (res % mod * a % mod);
      res %= mod;
    }
    a = (a % mod * a % mod) % mod;
    b /= 2;
  }
  return res % mod;
}
const int maxn = 1e6 + 1;
long long a[maxn], b[maxn];
string s;
void solve() {
  cin >> s;
  int n = s.size();
  for (int i = 0; i < n; i++) {
    a[i + 1] = a[i];
    b[i + 1] = b[i];
    if (s[i] == 'a')
      a[i + 1]++;
    else
      b[i]++;
  }
  long long res = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == 'b') {
      res = (res % mod + (Pow(2, a[i + 1]) - 1)) % mod;
    }
  }
  cout << res;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int t;
  t = 1;
  while (t--) {
    solve();
  }
}
