#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const long long INF = 0x7FFFFFFFFFFFFFFF / 2;
long long powah(long long b) {
  long long ans = 1, a = 2;
  while (b) {
    if ((b & 1) == 1) ans = (ans * a) % mod;
    a = (a * a) % mod;
    b >>= 1;
  }
  return ans;
}
long long sol(long long a, long long b) {
  a = a % mod;
  b = b % mod;
  long long ans = (powah(a) * b) % mod;
  return (ans - b + mod) % mod;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  string s;
  cin >> s;
  vector<pair<char, long long>> arr;
  for (char c : s) {
    if (arr.size() == 0)
      arr.push_back(make_pair(c, 1));
    else {
      if (arr[arr.size() - 1].first == c)
        arr[arr.size() - 1].second++;
      else
        arr.push_back(make_pair(c, 1));
    }
  }
  long long ans = 0;
  for (int i = 0; i < arr.size() - 1; i++) {
    if (arr[i].first == 'a' && arr[i + 1].first == 'b') {
      ans = (ans + sol(arr[i].second, arr[i + 1].second) % mod) % mod;
      if (i + 2 < arr.size()) arr[i + 2].second += arr[i].second;
    }
  }
  cout << ans;
  return 0;
}
