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;
int main() {
  long long mod = 1000000009;
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  string A;
  cin >> A;
  int n = A.size();
  vector<long long> dp(n, 0);
  long long curr = 0, with_b = 0;
  for (int i = 0; i < A.size(); i++) {
    if (A[i] == 'a') {
      dp[i] = long(1) + with_b;
      dp[i] %= mod;
      curr += dp[i];
    } else if (A[i] == 'b') {
      with_b = curr;
    }
  }
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    ans += dp[i];
    ans %= mod;
  }
  ans %= mod;
  cout << ans;
  return 0;
}
