#include <bits/stdc++.h>
using namespace std;
char a[1000005];
long long pow_mod(long long a, long long i) {
  if (i == 0) return 1;
  long long s = 1;
  while (i > 0) {
    if (i & 1) s = (s * a) % 1000000007;
    a = (a * a) % 1000000007;
    i >>= 1;
  }
  return s;
}
int main() {
  scanf("%s", a);
  int k = 0, cnt = 0, n = strlen(a);
  long long ans = 0;
  while (k < n & a[k] == 'b') k++;
  if (k >= n) {
    printf("0\n");
    return 0;
  }
  while (k < n) {
    while (a[k] == 'a' && k < n) {
      cnt++;
      k++;
    }
    if (k >= n) {
      printf("%I64d\n", ans);
      return 0;
    }
    int x = 0;
    while (a[k] == 'b' && k < n) {
      x++;
      k++;
    }
    ans = (ans + (pow_mod(2, cnt) - 1) * x) % 1000000007;
  }
  printf("%I64d\n", ans);
  return 0;
}
