#include <bits/stdc++.h>   using namespace std;   const long long mod = 1000000007;   const int max_length = 1e6;   int a_cnt[max_length];   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     string s;     cin >> s;     long long b = 0;     long long ans = 0;     int n = s.size();     for (int i = s.size() - 1; i >= 0; i--) {       if (s[i] ==  a  && b != 0) {         ans += b;         ans %= mod;         b = b * 2;         b %= mod;       } else if (s[i] ==  b )         b++;     }     cout << ans % mod;   }   