#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1000 * 1000 + 17, mod = 1e9 + 7;
int pw2[MAXN], ans;
string s;
int f(int n, int m) {
  if (n == 0 || m == 0) return 0;
  return (1LL * m * (pw2[n] - 1)) % mod;
}
void cal_ans(int i = 0) {
  int n = i, m = 0;
  while (s.size() > 0 && s.back() == 'a') s.pop_back(), n++;
  while (s.size() > 0 && s.back() == 'b') s.pop_back(), m++;
  ans += f(n, m);
  ans %= mod;
  if (s.size()) cal_ans(n);
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> s;
  pw2[0] = 1;
  for (int i = 1; i < MAXN; i++) pw2[i] = (2 * pw2[i - 1]) % mod;
  reverse(s.begin(), s.end());
  cal_ans();
  cout << ans << endl;
  return 0;
}
