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