#include <bits/stdc++.h>
using namespace std;
long long power(long long n) {
  long long res = 1ll;
  long long m = 2ll;
  while (n > 0) {
    if (n & 1) res = (res * m) % 1000000007;
    m = (m * m) % 1000000007;
    n = n >> 1;
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  string s;
  cin >> s;
  int n = s.length();
  long long ans = 0;
  long long a = 0, b = 0;
  for (int i = 0; i < n;) {
    while (i >= 0 && s[i] == 'a') {
      a++;
      i++;
    }
    while (i >= 0 && s[i] == 'b') {
      b++;
      i++;
    }
    ans = (ans + ((power(a) - 1) * b) % 1000000007) % 1000000007;
    b = 0;
  }
  cout << ans;
}
