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