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