#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int n, t = 1, k, i = 0, j, p = 1;
  string s;
  long long f = 0, b = 0, sum = 0, nb = 0, na = 0;
  cin >> s;
  f = s.find("a");
  if (f != -1) {
    for (i = f; i < s.length(); i++) {
      nb = 0;
      na = 0;
      while (i < s.length() && s[i] == 'a') {
        na++;
        i++;
      }
      while (i < s.length() && s[i] == 'b') {
        nb++;
        i++;
      }
      for (k = 0; k < na; k++) p = p * 2 % 1000000007;
      sum = sum % 1000000007 + (p - 1) * nb;
      i--;
    }
    cout << sum % 1000000007;
  } else
    cout << "0";
}
