#include <bits/stdc++.h>
using namespace std;
unsigned long long tab[1000002];
unsigned long long dp(long i) {
  if (tab[i] != -1) return tab[i];
  tab[i] = dp(i - 1) * 2;
  tab[i] %= 1000000007;
  return tab[i];
}
int main() {
  for (long k = 0; k < 1000002; k++) tab[k] = -1;
  tab[0] = 1;
  string t;
  cin >> t;
  unsigned long long i = 0;
  while (t[i] == 'b') i++;
  unsigned long long n = 0, s = 0;
  while (i < t.size()) {
    if (t[i] == 'a')
      n++;
    else {
      s += dp(n) - 1;
      s = s % (1000000007);
    }
    i++;
  }
  cout << s;
  return 0;
}
