aaaaabb
 aabaaaa
 babbabaabbbbabwbvbhbbbaaabbabbbbbbbkabbbbabaaabbbbbbajabbaaabazbbbzbalbabbwbbaabbabacabdbabbbfaaabbb
 baaahbbbba
 ababavvvv
 abnxabbaab
 krflnzhter
 amaabbbbxaabbbabaabaabbaaabaaaaabibbabaabaaabaabcaaxabablbbbbmbbbaaaaaabbaabbbaaabaaaababaababbabbbb
 babbbaaaaaabbbaabaaaaaoaabababaababaaaaababaaaaaaabbbbbbaaapaabaaabaaababaaaabaaaabaaaaababaaaabaaab

5
 14
 42467327
 7
 7
 11
 0
 98718509
 813881762

#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
const int mod = 1e9 + 7;
int main() {
  string s;
  cin >> s;
  int sum[N];
  sum[0] = 0;
  int n = s.size();
  for (int i = 0; i < n; ++i) {
    if (i == 0 && s[i] == 'a') {
      sum[0] = 1;
      continue;
    }
    if (s[i] == 'a')
      sum[i] = sum[i - 1] + 1;
    else
      sum[i] = sum[i - 1];
  }
  long long int ans = 0;
  pair<int, int> prev;
  prev.first = prev.second = -1;
  for (int i = 0; i < n; ++i) {
    int before;
    int after;
    if (s[i] != 'b') continue;
    if (s[i] == 'b') {
      before = sum[i];
      after = sum[n - 1] - sum[i];
    }
    if (prev.first == before && prev.second == after) continue;
    prev.first = before;
    prev.second = after;
    ans = ans + 1LL * before * after;
    if (ans >= mod) {
      ans -= mod;
    }
  }
  cout << ans + sum[n - 1] << "\n";
}
