#include <bits/stdc++.h>
int main() {
  char a[1000005];
  scanf("%s", a);
  int i;
  long long ans = 0, b = 0;
  for (i = strlen(a) - 1; i >= 0; i--) {
    if (a[i] == 'b')
      b++;
    else if (a[i] == 'a') {
      ans += b;
      b <<= 1;
    }
    ans %= 1000000007;
    b %= 1000000007;
  }
  printf("%lld\n", ans);
  return 0;
}
