#include <bits/stdc++.h>
using namespace std;
string second;
int main() {
  cin.sync_with_stdio(0);
  cin.tie(0);
  cin >> second;
  long long int n = second.length();
  long long int b = 0;
  long long int ans = 0;
  for (int i = n - 1; i >= 0; i--) {
    if (second[i] == 'b') b = (b + 1) % 1000000007;
    if (second[i] == 'a') {
      ans = (ans + b) % 1000000007;
      b = (b * 2) % 1000000007;
    }
  }
  cout << ans << "\n";
  return 0;
}
