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