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