#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:167177216")
using namespace std;
const long long MOD = 1000000000 + 7;
int main() {
  ios::sync_with_stdio(false);
  string s;
  cin >> s;
  long long bcount = 0;
  long long ans = 0;
  for (int i = s.size() - 1; i >= 0; --i) {
    if (s[i] == 'b') {
      bcount++;
    }
    if (s[i] == 'a') {
      ans += bcount;
      bcount *= 2;
      bcount %= MOD;
      ans %= MOD;
    }
  }
  cout << ans;
  return 0;
}
