#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long cnt[1000005];
void ini() {
  long long p = 1;
  cnt[0] = p;
  for (long long i = 1; i <= 1000005; i++) {
    p = ((p % 1000000007) * 2) % 1000000007;
    cnt[i] = ((cnt[i - 1]) % 1000000007 + (p % 1000000007)) % 1000000007;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  string s;
  cin >> s;
  ini();
  long long act = 0, sum = 0;
  for (long long i = 0; i < s.size(); i++)
    if (s[i] == 'a')
      act++;
    else if (act)
      sum = ((sum % 1000000007) + (cnt[act - 1] % 1000000007)) % 1000000007;
  cout << sum;
}
