#include <bits/stdc++.h>
using namespace std;
map<string, int> mapping;
int solve(string a) {
  if (mapping.count(a)) return mapping[a];
  int answer = 0;
  for (int i = 0; i + 1 < a.size(); ++i) {
    if (a[i] == 'a' && a[i + 1] == 'b') {
      string other = a.substr(0, i) + "bba" + a.substr(i + 2);
      answer = max(answer, 1 + solve(other));
    }
  }
  return mapping[a] = answer;
}
int mini(string a) {
  if (mapping.count(a)) return mapping[a];
  int answer = 1e9;
  bool exist = false;
  for (int i = 0; i + 1 < a.size(); ++i) {
    if (a[i] == 'a' && a[i + 1] == 'b') {
      string other = a.substr(0, i) + "bba" + a.substr(i + 2);
      answer = min(answer, 1 + mini(other));
      exist = true;
    }
  }
  if (!exist) {
    return 0;
  }
  return mapping[a] = answer;
}
const int maxN = 1000005;
char cad[maxN];
const int mod = 1e9 + 7;
int main() {
  scanf("%s", cad);
  int lenght = strlen(cad);
  int answer = 0;
  int cantb = 0;
  for (int i = lenght - 1; i >= 0; i--) {
    if (cad[i] == 'a') {
      answer += cantb;
      answer %= mod;
      cantb = (cantb * 2) % mod;
    } else {
      cantb++;
      cantb %= mod;
    }
  }
  cout << answer << endl;
  string input;
  cin >> input;
  return 0;
}
