#include <bits/stdc++.h>
using namespace std;
int main(void) {
  string s;
  cin >> s;
  long long mod = (long long)1e9 + 7;
  long long ans = 0;
  long long cnt = 0;
  int i = (int)s.size() - 1;
  while (s[i] == 'a') i--;
  if (i > 0) {
    while (i >= 0) {
      if (s[i] == 'b')
        cnt = (cnt + 1) % mod;
      else {
        ans = (ans + cnt) % mod;
        cnt = (cnt * 2) % mod;
      }
      i--;
    }
  }
  cout << ans << endl;
  return 0;
}
