#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  string s;
  cin >> s;
  long long x = 0, ans = 0;
  for (int i = s.size() - 1; i >= 0; i--) {
    if (s[i] == 'b')
      x++;
    else if (s[i] == 'a') {
      ans = (ans + x) % mod;
      x = (x * 2) % mod;
    }
  }
  cout << ans % mod;
  return 0;
}
