#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cerr.tie(0);
  string s;
  long long p = 0, q = 0;
  cin >> s;
  for (int i = s.size() - 1; i > -1; i--) {
    if (s[i] == 'a') {
      p += q;
      p = p % 1000000007;
      q = (2 * q) % 1000000007;
    } else {
      q = (q + 1) % 1000000007;
    }
  }
  cout << p;
  return 0;
}
