#include <bits/stdc++.h>
using namespace std;
char s[1000001];
inline void Moc(long long &x) {
  if (x >= 1000000007) x %= 1000000007;
}
inline int Fsp(long long x, int z) {
  register long long num = 1;
  while (z) {
    if (z & 1) (num *= x) %= 1000000007;
    (x *= x) %= 1000000007;
    z >>= 1;
  }
  return num;
}
int main() {
  register int n, na = 0, nb = 0;
  scanf("%s", s + 1);
  register long long ans = 0;
  n = strlen(s + 1);
  for (register int i = 1; i <= n; ++i) {
    if (s[i] == 'a') ++na;
    if (s[i] == 'b') ++nb;
    if (s[i] == 'b' && s[i + 1] != 'b') {
      ans += (long long)nb * (Fsp(2, na) - 1);
      nb = 0;
      Moc(ans);
    }
  }
  printf("%lld\n", ans);
  return 0;
}
