#include <bits/stdc++.h>
using namespace std;
long long int fun(long long int n) {
  long long int p;
  if (n == 0)
    return 1;
  else {
    p = fun(n / 2);
    if (n % 2 == 0)
      return ((p % 1000000007) * (p % 1000000007)) % 1000000007;
    else
      return ((((p % 1000000007) * (p % 1000000007)) % 1000000007) *
              (2 % 1000000007)) %
             1000000007;
  }
}
int main() {
  long long int i, l, r, t, k = 0, ans;
  char a[1000005];
  scanf("%s", a);
  l = strlen(a);
  t = 0;
  k = 0;
  for (i = 0; i < l; i++) {
    if (a[i] == 'a')
      t++;
    else
      k++;
  }
  ans = 0;
  for (i = l - 1; i >= 0; i--) {
    if (a[i] == 'a')
      t--;
    else {
      ans = (ans % 1000000007 + (fun(t) % 1000000007 - 1) % 1000000007) %
            1000000007;
    }
  }
  printf("%lld\n", ans);
  return 0;
}
