#include <bits/stdc++.h>
using namespace std;
int n;
char s[1000010];
int exp(int x, int n) {
  int sol = 1;
  while (n > 0) {
    if (n % 2 == 1) sol = (1LL * sol * x) % 1000000007;
    x = (1LL * x * x) % 1000000007;
    n = n / 2;
  }
  return sol;
}
int f(int x) {
  if (x < 0)
    return x + 1000000007;
  else
    return x;
}
int main() {
  scanf("%s", s + 1);
  n = strlen(s + 1);
  int answer = 0, ones = 0;
  s[0] = 'b';
  s[n + 1] = 'a';
  for (int i = 1; i <= n; i++) {
    int indx = i;
    while (indx <= n && s[indx] == 'a') indx++;
    if (s[indx] == 'b') {
      answer = (answer + f(exp(2, (indx - i) + ones) - 1)) % 1000000007;
      ones = (indx - i) + ones;
    }
    i = indx;
  }
  printf("%d", answer);
  return 0;
}
