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