#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int N = 1e6 + 5;
const int MOD = 1e9 + 7;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s;
  cin >> s;
  int l = s.size();
  int ans = 0, sum = 0;
  for (int i = l - 1; i >= 0; i--) {
    if (s[i] == 'b')
      sum++;
    else if (s[i] == 'a')
      ans = (ans + sum) % MOD, sum = (sum + sum) % MOD;
  }
  cout << ans << endl;
  return 0;
}
