#include <bits/stdc++.h>
using namespace std;
const int nmax = 1000011, base = 1000000007;
char s[nmax];
int main() {
  scanf("%s", s);
  long long ca = 0, cb = 0, n = strlen(s), ans = 0;
  for (int i = n - 1; i >= 0; --i) {
    if (s[i] == 'a') {
      ans += cb;
      cb = (cb + cb) % base;
      ca++;
    } else
      cb++;
  }
  cout << ans % base;
}
