#include <bits/stdc++.h>
using namespace std;
int l;
long long ans = 0, cnt = 0;
char s[1000004];
int main() {
  scanf("%s", s + 1);
  l = strlen(s + 1);
  for (int i = l; i >= 1; i--) {
    if (s[i] == 'a') {
      ans = (ans + cnt) % 1000000007LL;
      cnt = (cnt << 1) % 1000000007LL;
    } else
      cnt = (cnt + 1) % 1000000007LL;
  }
  printf("%I64d\n", ans);
  return 0;
}
