#include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 10, M = (long long int)1e9 + 1;
const int mod = (long long int)1e9 + 7, sz = 5;
string fir = "Monocarp", sec = "Bicarp";
vector<long long int> g[N];
long long int ds[N], dt[N], vis[N];
long long int po(long long int a, long long int x) {
  if (x == 0) return 1;
  if (x == 1) return a % mod;
  long long int z = po(a, x / 2) % mod;
  z = (z * z) % mod;
  if (x & 1) z = (z * a) % mod;
  return z;
}
void work() {
  string second;
  cin >> second;
  long long int l = second.length(), c = 0;
  for (long long int i = 0; i < l; i++) {
    if (second[i] == 'b') c++;
  }
  long long int ans = 0, cnt = 0;
  for (long long int i = 0; i < l; i++) {
    if (second[i] == 'a')
      cnt++;
    else
      ans = (ans + po(2ll, cnt)) % mod;
  }
  cout << (ans + mod - c) % mod;
  return;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long int t;
  t = 1;
  while (t--) {
    work();
  }
  return 0;
}
