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;
long long mod = 1e9 + 7;
long long pow_mod(long long a, long long b, long long Mod) {
  long long ans = 1;
  while (b > 0) {
    if (b & 1) {
      ans = ans * a % Mod;
    }
    a = a * a % Mod;
    b >>= 1;
  }
  return ans;
}
char s[100005];
int g[100005], v[100005];
int main() {
  scanf("%s", s + 1);
  int cnt = 0;
  for (int i = 1; s[i] != '\0'; i++) {
    if (s[i] == 'a') v[++cnt] = i;
    g[i] = g[i - 1] + s[i];
  }
  cout << cnt << endl;
  long long ans = 0;
  for (int i = 1; i < cnt;) {
    long long h = 1;
    while (1) {
      if (g[v[i + 1] - 1] - g[v[i]] == (v[i + 1] - v[i] - 1) * 'b' &&
          v[i + 1] - v[i] != 1) {
        h++;
        i++;
      } else
        break;
    }
    ans += pow_mod(2, h, mod) - 2;
    i++;
  }
  cout << ans + cnt << endl;
}
