#include <bits/stdc++.h>
using namespace std;
long long op[1000010];
int main() {
  op[1] = 1LL;
  for (int i = 2; i <= 1000000; i++) {
    op[i] = op[i - 1] * 2 + 1;
    op[i] %= 1000000007;
  }
  string s;
  cin >> s;
  long long cnt = 0;
  int a = 0;
  int b = 0;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == 'a')
      a++;
    else {
      cnt += op[a];
      cnt %= 1000000007;
    }
  }
  cout << cnt << endl;
}
