#include <bits/stdc++.h>
using namespace std;
long long add(long long m, long long n) {
  return ((m % 1000000007) + (n % 1000000007)) % 1000000007;
}
long long mul(long long m, long long n) {
  return ((m % 1000000007) * (n % 1000000007)) % 1000000007;
}
int main() {
  long long res = 0;
  string str;
  cin >> str;
  long long cnt_a = 0;
  long long cnt_b = 0;
  for (int i = str.length() - 1; i >= 0; i--) {
    if (str[i] == 'b')
      cnt_b++;
    else if (str[i] == 'a') {
      res = add(res, cnt_b);
      cnt_b = mul(cnt_b, 2);
    }
  }
  cout << res;
}
