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