#include <bits/stdc++.h>
using namespace std;
const long long inf = (long long)1e18;
const long long mod = (long long)1e9 + 7;
const double pi = acos(-1.0);
const double eps = (double)1e-9;
const int dx[] = {0, 0, 1, 0, -1};
const int dy[] = {0, 1, 0, -1, 0};
const int N = 1000500;
long long ans;
char c[N];
long long bp(long long a, long long b) {
  long long res = 1;
  while (b) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
    b >>= 1;
  }
  return res;
}
int main() {
  scanf("%s", c + 1);
  int len = strlen(c + 1);
  int pw = 0;
  for (int i = 1; i <= len; i++) {
    if (c[i] == 'a') {
      int j = i;
      pw++;
      while (j < len && c[j + 1] == 'a') j++, pw++;
      if (j < len && c[j + 1] == 'b') {
        int k = j;
        while (k < len && c[k + 1] == 'b') k++;
        ans = ((bp(2ll, pw) - 1 + mod) % mod * (k - j + 0ll) % mod + ans) % mod;
        j = k;
      }
      i = j;
    }
  }
  printf("%I64d", ans);
  return 0;
}
