#include <bits/stdc++.h>
using namespace std;
long long int power(long long int x, long long int y) {
  if (y == 0)
    return 1;
  else if (y % 2 == 0)
    return power(x, y / 2) * power(x, y / 2);
  else
    return x * power(x, y / 2) * power(x, y / 2);
}
long long int binsearch(long long int a[], long long int n, long long int x) {
  long long int low = 1;
  long long int high = n;
  long long int ans;
  while (low <= high) {
    long long int mid = (low + high) / 2;
    if (a[mid] == x)
      return mid;
    else if (a[mid] > x) {
      ans = mid;
      high = mid - 1;
    } else {
      low = mid + 1;
    }
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  string s;
  cin >> s;
  long long int i, n = s.length();
  vector<long long int> v;
  long long int p;
  for (i = n - 1; i >= 0; i--) {
    if (s[i] == 'b') {
      p = i + 1;
      break;
    }
  }
  for (i = 0; i < p; i++) {
    if (s[i] == 'a') v.push_back(i + 1);
  }
  long long int l = v.size();
  long long int d;
  long long int ans = p - v[l - 1];
  if (l == 1)
    cout << ans << endl;
  else {
    long long int x = ans * 2;
    for (i = l - 2; i > 0; i--) {
      d = v[i + 1] - v[i] - 1;
      x += d;
      ans = (ans % 1000000007 + x % 1000000007) % 1000000007;
      x = (x % 1000000007 * 2) % 1000000007;
    }
    d = v[1] - v[0] - 1;
    x += d;
    ans = (ans % 1000000007 + x % 1000000007) % 1000000007;
    cout << ans % 1000000007 << endl;
  }
}
