#include <bits/stdc++.h>
using namespace std;
long long mod = 1e9 + 7;
int main() {
  char s[1000006];
  scanf("%s", &s);
  int l = strlen(s);
  long long ans = 0;
  long long sumb = 0;
  for (int i = l - 1; i >= 0; i--) {
    if (s[i] == 'b') sumb++;
    sumb %= mod;
    if (s[i] == 'a') {
      ans = (ans + sumb) % mod;
      sumb = (sumb * 2) % mod;
    }
  }
  printf("%I64d\n", ans);
  return 0;
}
