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