#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e18;
const int maxn = 2e5 + 10;
const long long MOD = 1000000007;
const double EPS = 1e-10;
const double Pi = acos(-1.0);
int main() {
  string s;
  cin >> s;
  long long b = 0, ans = 0;
  for (int i = s.size() - 1; i >= 0; i--) {
    if (s[i] == 'b') b++, b %= MOD;
    if (s[i] == 'a') ans += b, ans %= MOD, b *= 2;
  }
  cout << ans << endl;
  return 0;
}
