#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e6;
const int P = 1e9 + 7;
int N;
char s[MAXN];
int dp[MAXN];
int main() {
  scanf("%s", s);
  N = strlen(s);
  for (int i = N - 1; i >= 0; i--) {
    if (s[i] == 'a') {
      dp[i] = 2 * dp[i + 1] % P;
    } else {
      dp[i] = (dp[i + 1] + 1) % P;
    }
  }
  int ans = dp[0];
  for (int i = 0; i < N; i++) {
    ans = (ans - (s[i] == 'b') + P) % P;
  }
  printf("%d\n", ans);
}
