#include <bits/stdc++.h>
using namespace std;
const long long maxx = 1e6 + 10, mod = 1e9 + 7;
long long used[maxx + 5], sum = 0;
long long fastpow(long long n, long long k) {
  if (used[k] != 0) {
    return used[k];
  }
  long long ans = 1;
  while (k > 0) {
    if (k & 1) {
      ans = (long long)(ans * n) % mod;
    }
    k = k >> 1;
    n = (long long)(n * n) % mod;
  }
  return used[k] = ans;
}
int main() {
  long long val = 0;
  string s;
  cin >> s;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == 'a') {
      sum++;
    } else if (sum > 0) {
      val = (val + fastpow(2, sum) - 1 + mod) % mod;
    }
  }
  cout << val << endl;
  return 0;
}
