#include <bits/stdc++.h>
using namespace std;
char s[1000005];
int main() {
  scanf("%s", s);
  int len = strlen(s) - 1;
  long long b = 0, ans = 0;
  for (int i = len; i >= 0; i--) {
    if (s[i] == 'a') {
      ans = (ans + b) % 1000000007;
      b = b * 2 % 1000000007;
    } else {
      b++;
      b %= 1000000007;
    }
  }
  cout << ans << endl;
  return 0;
}
