#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
int main() {
  char a[1000000 + 10];
  cin >> a;
  long long sum, b;
  sum = b = 0;
  long long len = strlen(a);
  for (long long i = len - 1; i >= 0; i--) {
    if (a[i] == 'b')
      b++;
    else if (a[i] == 'a') {
      (sum += b) %= mod;
      (b = b + b) %= mod;
    }
  }
  cout << sum;
}
