#include <bits/stdc++.h>
const int M = 500000 + 7;
const int mod = 1e9 + 7;
using std::max;
using std::min;
using std::swap;
inline int read() {
  int x = 0, f = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = x * 10 + c - '0';
    c = getchar();
  }
  return x * f;
}
void print(int x) {
  if (x < 0) {
    putchar('-');
    x = -x;
  }
  if (x >= 10) print(x / 10);
  putchar(x % 10 + '0');
}
char s[M];
long long N, f[M], sum[M], lasa, ol, fl;
int main() {
  scanf("%s", s + 1);
  N = strlen(s + 1);
  for (int i = 1; i <= N; i++) {
    if (s[i] == 'a') {
      f[i] = 1;
      (f[i] += sum[ol]) %= mod;
      lasa = i;
      fl = 1;
    }
    if (s[i] == 'b') fl = 0, ol = lasa;
    sum[i] = (sum[i - 1] + f[i]) % mod;
  }
  std::cout << sum[N] % mod;
  return 0;
}
