#include <bits/stdc++.h>
using namespace std;
void A();
void B();
void C();
void D();
void E();
void F();
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  A();
}
void A() {
  string s;
  cin >> s;
  const int mod = 1E9 + 7;
  long long numB = 0;
  long long total = 0;
  for (int i = s.length() - 1; i >= 0; i--) {
    if (s[i] == 'b')
      numB++;
    else if (s[i] == 'a') {
      total += numB % mod;
      numB *= 2;
      total %= mod;
      numB %= mod;
    }
  }
  cout << total;
}
void B() {
  int T;
  cin >> T;
  for (int t = 1; t <= T; t++) {
    int N;
    cin >> N;
    int result = 0;
    cout << "Case #" << t << ": ";
    cout << result << endl;
  }
}
void C() {
  int T;
  cin >> T;
  for (int t = 1; t <= T; t++) {
    int N;
    cin >> N;
    int result = 0;
    cout << "Case #" << t << ": ";
    cout << result << endl;
  }
}
void D() {
  int T;
  cin >> T;
  for (int t = 1; t <= T; t++) {
    int N;
    cin >> N;
    int result = 0;
    cout << "Case #" << t << ": ";
    cout << result << endl;
  }
}
void E() {
  int T;
  cin >> T;
  for (int t = 1; t <= T; t++) {
    int N;
    cin >> N;
    int result = 0;
    cout << "Case #" << t << ": ";
    cout << result << endl;
  }
}
void F() {
  int T;
  cin >> T;
  for (int t = 1; t <= T; t++) {
    int N;
    cin >> N;
    int result = 0;
    cout << "Case #" << t << ": ";
    cout << result << endl;
  }
}
