#include <bits/stdc++.h>
using namespace std;
int num;
string s;
long long ans, der[1000006];
int main() {
  cin >> s;
  der[0] = 1;
  for (int i = 1; i <= s.size(); i++) der[i] = (der[i - 1] * 2) % 1000000007;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == 'a')
      num++;
    else {
      ans = (ans + der[num] - 1) % 1000000007;
      if (ans < 0) ans += 1000000007;
    }
  }
  cout << ans;
}
