#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:256000000")
using namespace std;
const int nmax = 100010;
unsigned long long cnt = 1e+9 + 7;
long double eps = 1e-5;
unsigned long long rs, p, n, c, d, m, l, r, b;
string s;
long long a;
unsigned long long res;
int main() {
  cin >> s;
  l = s.length();
  d = 1;
  for (int i = 0; i < l; ++i) {
    if (s[i] == 'a') {
      p ^= 1;
      b = i;
      while (b < l && s[b] == 'a') {
        rs = ((rs % cnt) + (d % cnt)) % cnt;
        d = (d * 2) % cnt;
        ++b;
      }
      --b;
      i = b;
    }
    if (p && s[i] == 'b') {
      p ^= 1;
      b = 0;
      while (i < l && s[i] == 'b') {
        ++b;
        ++i;
      }
      --i;
      res = ((res % cnt) + ((rs * b) % cnt)) % cnt;
    }
  }
  cout << res;
  return 0;
}
