#include <bits/stdc++.h>
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")
using namespace std;
template <class T>
T sqr(T x) {
  return x * x;
}
template <class T>
T gcd(T a, T b) {
  return b ? gcd(b, a % b) : a;
}
template <class T1, class T2>
T1 chmin(T1& x, const T2& y) {
  if (T1(y) < x) return x = y;
  return x;
}
template <class T1, class T2>
T1 chmax(T1& x, const T2& y) {
  if (T1(y) > x) return x = y;
  return x;
}
template <class T1, class T2>
ostream& operator<<(ostream& os, const pair<T1, T2>& p) {
  return os << '(' << p.first << ", " << p.second << ')';
}
template <class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
  os << '{';
  bool was = false;
  for (const T& x : v) {
    if (was) os << ", ";
    was = true;
    os << x;
  }
  os << '}';
  return os;
}
template <class T>
ostream& operator<<(ostream& os, const set<T>& v) {
  os << '[';
  bool was = false;
  for (const T& x : v) {
    if (was) os << ", ";
    was = true;
    os << x;
  }
  os << ']';
  return os;
}
template <class T>
ostream& operator<<(ostream& os, const multiset<T>& v) {
  os << '[';
  bool was = false;
  for (const T& x : v) {
    if (was) os << ", ";
    was = true;
    os << x;
  }
  os << ']';
  return os;
}
template <class T1, class T2>
ostream& operator<<(ostream& os, const map<T1, T2>& m) {
  os << '<';
  bool was = false;
  for (const auto& x : m) {
    if (was) os << ", ";
    was = true;
    os << x;
  }
  os << '>';
  return os;
}
const int INF = (int)2e9;
const long long LINF = (long long)2e18;
const int MOD = (int)1e9 + 7;
const int MAXN = (int)1e6 + 10;
string s;
int ans = 0, lst = -1, cnt = 0;
int step[MAXN];
int main() {
  ios_base::sync_with_stdio(false);
  cin >> s;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == 'b') lst = i;
  }
  step[0] = 1;
  for (int i = 1; i < MAXN; i++) step[i] = (step[i - 1] * 2) % MOD;
  if (lst == -1) {
    cout << 0;
    return 0;
  }
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == 'a') {
      cnt++;
      continue;
    }
    ans = (ans + step[cnt]) % MOD;
    ans = (ans - 1 + MOD) % MOD;
  }
  cout << ans;
}
