#include <bits/stdc++.h>
using namespace std;
template <typename T>
struct outputer;
struct outputable {};
template <typename T>
inline auto sqr(T x) -> decltype(x * x) {
  return x * x;
}
template <typename T1, typename T2>
inline bool umx(T1& a, T2 b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename T1, typename T2>
inline bool umn(T1& a, T2 b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
const int N = 1000000;
const int mod = 1000000007;
struct Input {
  string s;
  bool read() { return !!getline(cin, s); }
  void init(const Input& input) { *this = input; }
};
struct Data : Input {
  int64_t ans;
  void write() { cout << ans << endl; }
};
namespace Main {
struct Solution : Data {
  int64_t d[N + 1];
  void solve() {
    d[0] = 0;
    for (int i = int(0); i < int(N); ++i) {
      d[i + 1] = (d[i] * 2 + 1) % mod;
    }
    ans = 0;
    int cnt = 0;
    for (int i = int(0); i < int(((int)(s).size())); ++i) {
      if (s[i] == 'a') {
        cnt++;
      } else {
        ans = (ans + d[cnt]) % mod;
      }
    }
  }
  void clear() { *this = Solution(); }
};
}  // namespace Main
Main::Solution sol;
int main() {
  cout.setf(ios::showpoint | ios::fixed);
  cout.precision(20);
  sol.read();
  sol.solve();
  sol.write();
  return 0;
}
