#include <bits/stdc++.h>
using namespace std;
char s[1000005];
const long long Mod = 1e9 + 7;
int main() {
  long long n, m;
  while (~scanf("%s", s)) {
    n = strlen(s) - 1;
    while (s[n] == 'a') n--;
    m = 0;
    long long p = 1;
    for (int i = n; i >= 0; i--) {
      if (i - 1 >= 0 && s[i - 1] == 'a' && s[i] == 'b') {
        s[i - 1] = 'b';
        m = (m + p % Mod) % Mod;
        p = 2 * p % Mod;
      } else if (i - 1 >= 0 && s[i - 1] == 'b' && s[i] == 'b') {
        p = (p + 1) % Mod;
      }
    }
    cout << m << endl;
  }
  return 0;
}
