#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int maxn = 1e6 + 2;
char a[maxn];
long long pow(long long a, long long n) {
  long long result = 1;
  while (n) {
    if (n & 1) result *= a;
    a *= a;
    n >>= 1;
  }
  return result;
}
int main() {
  scanf("%s", a);
  long long ans = 0;
  int l = strlen(a);
  int cnt_a = 0;
  int cnt_b = 0;
  int i, j, k;
  int pos_a, pos_b;
  long long result = 0;
  for (i = l - 1; i >= 0; i--) {
    if (a[i] == 'b') {
      result++;
      if (result >= mod) result %= mod;
    } else if (a[i] == 'a') {
      ans += result;
      if (ans >= mod) ans %= mod;
      result *= 2;
      if (result >= mod) result %= mod;
    }
  }
  cout << ans << endl;
  return 0;
}
