#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int maxn = 1000010;
int n;
char s[maxn];
int main() {
  scanf("%s", s + 1);
  n = strlen(s + 1);
  int b = 0;
  int ans = 0;
  for (register int i = n; i >= 1; i--) {
    if (s[i] == 'a') {
      ans = (1LL * ans + 1LL * b) % mod;
      b = b * 2LL % mod;
    } else {
      b++;
      b %= mod;
    }
  }
  printf("%d\n", ans);
  return 0;
}
