import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop;

long powmod(long a, long x, long m) {
    long ret = 1;
    while (x) {
        if (x % 2) ret = ret * a % m;
        a = a * a % m;
        x /= 2;
    }
    return ret;
}

void main() {
    immutable long MOD = 10^^9 + 7;

    auto S = readln.chomp;
    auto N = S.length.to!int;

    long a = 0;
    long b = 0;
    long ans = 0;
    char prev = 'x';
    foreach (i; 0..N) {
        if (S[i] == 'a' && prev == 'b') {
            ans += b * (powmod(2, a, MOD) - 1) % MOD;
            ans = (ans + MOD) % MOD;
            a++;
            b = 0;
        }
        else if (S[i] == 'a') {
            a++;
        }
        else {
            b++;
        }

        prev = S[i];
    }

    ans += b * (powmod(2, a, MOD) - 1) % MOD;
    ans = (ans + MOD) % MOD;

    ans.writeln;
}
