aaaaabb
 aabaaaa
 babbabaabbbbabwbvbhbbbaaabbabbbbbbbkabbbbabaaabbbbbbajabbaaabazbbbzbalbabbwbbaabbabacabdbabbbfaaabbb
 baaahbbbba
 ababavvvv
 abnxabbaab
 krflnzhter
 amaabbbbxaabbbabaabaabbaaabaaaaabibbabaabaaabaabcaaxabablbbbbmbbbaaaaaabbaabbbaaabaaaababaababbabbbb
 babbbaaaaaabbbaabaaaaaoaabababaababaaaaababaaaaaaabbbbbbaaapaabaaabaaababaaaabaaaabaaaaababaaaabaaab

5
 14
 42467327
 7
 7
 11
 0
 98718509
 813881762

import java.io.*;
import java.util.*;

public class Main {
    private static InputReader in;
    private static PrintWriter out;

    public static void main(String[] args) {
        in = new InputReader();
        out = new PrintWriter(System.out);
        int t = 1;
//        t = in.nextInt();
        for (int i = 0; i < t; ++i) {
            solve();
        }
        out.close();
    }

    static final int MODULO = (int) (1e9 + 7);

    static int MAX = (int) (5e5);

    static long[] tree = new long[MAX];

    private static void update(int node, int start, int end, int pos, long val) {
        if (start == end) {
            tree[node] = val;
            return;
        }
        int mid = (start + end) >> 1;
        if (pos <= mid) {
            update(2 * node + 1, start, mid, pos, val);
        } else {
            update(2 * node + 2, mid + 1, end, pos, val);
        }
        tree[node] = (tree[2 * node + 1] + tree[2 * node + 2]) % MODULO;
    }

    private static long query(int node, int start, int end, int l, int r) {
        if (end < l || r < start) return 0;
        if (l <= start && end <= r) return tree[node];
        int mid = (start + end) >> 1;
        long left = query(2 * node + 1, start, mid, l, r) % MODULO,
                right = query(2 * node + 2, mid + 1, end, l, r) % MODULO;
        return (left + right) % MODULO;

    }

    private static void solve() throws RuntimeException {
        String s = in.next();
        int n = s.length();
        ArrayList<Integer> a = new ArrayList<>();
        ArrayList<Integer> b = new ArrayList<>();
        for (int i = 0; i < n; ++i) {
            if (s.charAt(i) == 'a') {
                a.add(i);
            } else if (s.charAt(i) == 'b') {
                b.add(i);
            }
        }
//        out.println(a);
//        out.println(b);
        long ans = 0;
        for (int i = 0; i < a.size(); ++i) {
            int low = 0, high = i - 1, at = -1;
            while (low <= high) {
                int mid = (low + high) >> 1;
                if (can(a.get(mid), a.get(i), b)) {
                    at = mid;
                    low = mid + 1;
                } else {
                    high = mid - 1;
                }
            }
            long toAdd;
            if (at == -1) {
                toAdd = 1;
            } else {
                toAdd = query(0, 0, a.size() - 1, 0, at) + 1;
            }
//            out.println(i + "  " + toAdd );
            ans = (ans + toAdd) % MODULO;
            update(0, 0, a.size() - 1, i, toAdd);
        }
        out.println(ans);
    }

    private static long pow(long x, int e) {
        long res = 1;
        while (e > 0) {
            if (e % 2 == 1) {
                res = (res * x) % MODULO;
            }
            x = (x * x) % MODULO;
            e >>= 1;
        }
        return res;
    }

    private static boolean can(Integer l, int r, ArrayList<Integer> b) {
        int low = 0, high = (int) b.size() - 1;
        while (low <= high) {
            int mid = (low + high) >> 1;
            if (b.get(mid) < l) {
                low = mid + 1;
            } else if (b.get(mid) > r) {
                high = mid - 1;
            } else {
                return true;
            }
        }
        return false;
    }

    static class InputReader {
        BufferedReader br;
        StringTokenizer st;

        public InputReader() {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}