#include <bits/stdc++.h>
using namespace std;
int n, l, ans;
char a[1000000];
int main() {
  cin >> a;
  l = strlen(a);
  for (int i = l - 1; i >= 0; i--) {
    if (a[i] == 'b') n++;
    if (a[i] == 'a') {
      ans += n;
      ans %= 1000000007;
      n *= 2;
      n %= 1000000007;
    }
  }
  cout << ans;
  return 0;
}
