#include <bits/stdc++.h>
using namespace std;
const int MAX = 1e6 + 10;
const int MOD = 1e9 + 7;
char str[MAX];
int main() {
  scanf("%s", str);
  int len = strlen(str);
  int index = len;
  int numb = 0, numa = 0;
  int ans = 0;
  while (str[--index] == 'a')
    ;
  for (int i = index; i >= 0; i--) {
    if (str[i] == 'a') {
      ans = (ans + numb) % MOD;
      numb = (numb * 2) % MOD;
    } else {
      numb++;
    }
  }
  cout << ans << endl;
}
