import java.util.Scanner;

public class er {
    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);
        String string = scanner.nextLine();
        int[] t = new int[100001];
        for (int i = 0; i < t.length; i++) {
            t[i] = 1;
        }
        int j = 0;
        for (int i = 0; i < string.length(); i++) {
            if (string.charAt(i) == 'b') {
                j++;
            } else if (string.charAt(i) == 'a') {
                t[j] += 1;
            }
        }
        int res = 1;
        for (int i = 0; i < t.length; i++) {
            res *= t[i];
            res = res % (1000000007);
            //System.out.println(res);
        }

        /*for (int i=0;i<t.length;i++){
            System.out.println(t[i]);
        }*/
        System.out.println(res - 1);

    }

}


import java.util.Scanner;

public class er {
    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);
        String string = scanner.nextLine();
        int[] t = new int[1000001];
        for (int i = 0; i < t.length; i++) {
            t[i] = 1;
        }
        int j = 0;
        for (int i = 0; i < string.length(); i++) {
            if (string.charAt(i) == 'b') {
                j++;
            } else if (string.charAt(i) == 'a') {
                t[j] += 1;
            }
        }
        int res = 1;
        for (int i = 0; i < t.length; i++) {
            res *= t[i];
            res = res % (int)(1e9+7);
            //System.out.println(res);
        }

        /*for (int i=0;i<t.length;i++){
            System.out.println(t[i]);
        }*/
        System.out.println(res - 1);

    }

}


import java.util.Scanner;

public class er {
    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);
        String string = scanner.nextLine();
        int[] t = new int[1000001];
        for (int i = 0; i < t.length; i++) {
            t[i] = 1;
        }
        int j = 0;
        for (int i = 0; i < string.length(); i++) {
            if (string.charAt(i) == 'b') {
                j++;
            } else if (string.charAt(i) == 'a') {
                t[j] += 1;
            }
        }
        long res;
        res = 1;
        for (int i = 0; i < t.length; i++) {
            res *= t[i];
            res = res %1000000007;
            //System.out.println(res);
        }

        /*for (int i=0;i<t.length;i++){
            System.out.println(t[i]);
        }*/
        System.out.println(res - 1);

    }

}


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

public class mymy
{

	static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));

	static long mod=1000000007;

	public static void main(String[] args)throws IOException{

		String s=br.readLine();
		int n=s.length();

		ArrayList<Integer> a=new ArrayList<Integer>();
		int temp=0;
		for(int i=0;i<n;i++)
		{
			if(s.charAt(i)=='a')
				temp++;
			if(s.charAt(i)=='b')
			{
				if(temp!=0)
					a.add(temp);
				temp=0;
			}
		}
		if(temp!=0)
			a.add(temp);
		long tot=1;
		for(int i=0;i<a.size();i++)
		{
			a.set(i,a.get(i)+1);
			tot*=a.get(i);
			tot%=mod;
		}
		tot-=1;
		if(tot<0)
			tot+=mod;

		System.out.println(tot%mod);

	}

}


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

public class mymy
{

	static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));

	static long mod=1000000007;

	static long tot=0;

	public static void main(String[] args)throws IOException{

		String s=br.readLine();
		int n=s.length();

		ArrayList<Integer> a=new ArrayList<Integer>();
		int temp=0;
		for(int i=0;i<n;i++)
		{
			if(s.charAt(i)=='a')
				temp++;
			if(s.charAt(i)=='b')
			{
				if(temp!=0)
					a.add(temp);
				temp=0;
			}
		}
		if(temp!=0)
			a.add(temp);
		int[] arr=new int[a.size()];
		for(int i=0;i<a.size();i++)
			arr[i]=a.get(i);

		for(int i=1;i<=n;i++)
		{
			printCombination(arr, arr.length, i);
		}

		System.out.println(tot);

	}

	static void combinationUtil(int arr[], int n, int r,int index, int data[], int i)
	{
		if (index == r) {
			long total=1;
			for (int j = 0; j < r; j++)
			{
				total*=data[j];
				total%=mod;
			}
			tot+=total;
			tot%=mod;
			return;
		}
		if (i >= n)
			return;
		data[index] = arr[i];
		combinationUtil(arr, n, r, index + 1, data, i + 1);
		combinationUtil(arr, n, r, index, data, i + 1);
	}
	static void printCombination(int arr[], int n, int r)
	{
		int data[] = new int[r];
		combinationUtil(arr, n, r, 0, data, 0);
	}

}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.Vector;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        Task526C solver = new Task526C();
        solver.solve(1, in, out);
        out.close();
    }

    static class Task526C {
        int sum = 0;
        long ans = 0;

        public void solve(int testNumber, InputReader in, OutputWriter out) {
            String s = in.nextString();
            Vector<Integer> v = new Vector<>();
            int i, n = s.length(), cou = 0;

            for (i = 0; i < n; i++) {
                char c = s.charAt(i);
                if (c == 'a')
                    cou++;
                else if (c == 'b' && cou != 0) {
                    v.add(cou);
                    cou = 0;
                }
            }
            v.add(cou);

        /*for(int sa:v)
        {
            out.print(sa + " ");
        }*/

            int m = v.size();
            int a[] = new int[m];
            i = 0;
            for (int sa : v) {
                a[i] = sa;
                i++;
            }

            allCombination(a, m);
            //out.println(a);
            out.println(ans);
        }

        void allCombination(int[] a,
                            int n) {
            for (int i = 1; i <= n; i++) {
                int[] combi = new int[i];

                Combination(a, combi, n,
                        i, 0, 0);
                ans += sum;
                sum = 0;
            }
        }

        void Combination(int[] a, int[] combi,
                         int n, int r,
                         int depth, int index) {
            if (index == r) {
                int product = 1;
                for (int i = 0; i < r; i++)
                    product = product * combi[i];
                sum += product;
                return;
            }
            for (int i = depth; i < n; i++) {
                combi[index] = a[i];
                Combination(a, combi, n, r,
                        i + 1, index + 1);
            }
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public String nextString() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            StringBuilder res = new StringBuilder();
            do {
                if (Character.isValidCodePoint(c)) {
                    res.appendCodePoint(c);
                }
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void close() {
            writer.close();
        }

        public void println(long i) {
            writer.println(i);
        }

    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.Vector;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        Task526C solver = new Task526C();
        solver.solve(1, in, out);
        out.close();
    }

    static class Task526C {
        public void solve(int testNumber, InputReader in, OutputWriter out) {
            String s = in.nextString();
            Vector<Long> v = new Vector<>();
            int i, n = s.length();
            long ans = 1,cou=0;
            long mod = (int)1e9+7;

            for (i = 0; i < n; i++) {
                char c = s.charAt(i);
                if (c == 'a')
                    cou++;
                else if (c == 'b' && cou != 0) {
                    v.add(cou);
                    cou = 0;
                }
            }

            if (cou != 0)
                v.add(cou);

            for (long sa : v) {
                sa++;
                ans *= sa;
                ans %= mod;
            }

            //System.out.println(v);

            ans--;
            //ans += mod;
            ans %= mod;
            if(ans<0)
                ans += mod;
            //out.println(a);
            out.println(ans);
        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void close() {
            writer.close();
        }

        public void println(long i) {
            writer.println(i);
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public String nextString() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            StringBuilder res = new StringBuilder();
            do {
                if (Character.isValidCodePoint(c)) {
                    res.appendCodePoint(c);
                }
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.Vector;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        Task526C solver = new Task526C();
        solver.solve(1, in, out);
        out.close();
    }

    static class Task526C {
        public void solve(int testNumber, InputReader in, OutputWriter out) {
            String s = in.nextString();
            Vector<Long> v = new Vector<>();
            int i, n = s.length();
            long ans = 1,cou=0;
            long mod = (int)10e9+7;

            for (i = 0; i < n; i++) {
                char c = s.charAt(i);
                if (c == 'a')
                    cou++;
                else if (c == 'b' && cou != 0) {
                    v.add(cou);
                    cou = 0;
                }
            }

            if (cou != 0)
                v.add(cou);

            for (long sa : v) {
                sa++;
                ans *= sa;
                ans %= mod;
            }

            //System.out.println(v);

            ans--;
            ans %= mod;
            //out.println(a);
            out.println(ans);
        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void close() {
            writer.close();
        }

        public void println(long i) {
            writer.println(i);
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public String nextString() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            StringBuilder res = new StringBuilder();
            do {
                if (Character.isValidCodePoint(c)) {
                    res.appendCodePoint(c);
                }
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.Vector;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        Task526C solver = new Task526C();
        solver.solve(1, in, out);
        out.close();
    }

    static class Task526C {
        public void solve(int testNumber, InputReader in, OutputWriter out) {
            String s = in.nextString();
            Vector<Long> v = new Vector<>();
            int i, n = s.length();
            long ans = 1,cou=0;

            for (i = 0; i < n; i++) {
                char c = s.charAt(i);
                if (c == 'a')
                    cou++;
                else if (c == 'b' && cou != 0) {
                    v.add(cou);
                    cou = 0;
                }
            }

            if (cou != 0)
                v.add(cou);

            for (long sa : v) {
                sa++;
                ans *= sa;
                ans %= (int)10e9+7;
            }

            //System.out.println(v);

            ans--;
            //out.println(a);
            out.println(ans);
        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void close() {
            writer.close();
        }

        public void println(long i) {
            writer.println(i);
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public String nextString() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            StringBuilder res = new StringBuilder();
            do {
                if (Character.isValidCodePoint(c)) {
                    res.appendCodePoint(c);
                }
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.Vector;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        Task526C solver = new Task526C();
        solver.solve(1, in, out);
        out.close();
    }

    static class Task526C {
        long ans = 0;

        public void solve(int testNumber, InputReader in, OutputWriter out) {
            String s = in.nextString();
            Vector<Integer> v = new Vector<>();
            int i, n = s.length(), cou = 0;

            for (i = 0; i < n; i++) {
                char c = s.charAt(i);
                if (c == 'a')
                    cou++;
                else if (c == 'b' && cou != 0) {
                    v.add(cou);
                    cou = 0;
                }
            }
            v.add(cou);

        /*for(int sa:v)
        {
            out.print(sa + " ");
        }*/

            int m = v.size();
            int a[] = new int[m];
            i = 0;
            for (int sa : v) {
                a[i] = sa;
                i++;
            }
            allCombination(a, m);
            //out.println(a);
            out.println(ans);
        }

        void allCombination(int[] a,
                            int n) {
            int sum = 0;
            for (int i = 0; i < n; i++) {
                sum += a[i];
            }
            ans += sum;
            //out.println("sum1" + sum);
            for (int i = 1; i < n; i++) {
                postfix(a, n - i + 1);
                sum = 0;
                for (int j = 1; j <= n - i; j++) {
                    sum += (j * a[j]);
                }
                //out.println("sum" + i + " " + sum);
                ans += sum;
                modify(a, n);
            }
        }

        void modify(int a[], int n) {
            for (int i = 1; i < n; i++) {
                a[i - 1] = i * a[i];
            }
        }

        void postfix(int a[], int n) {
            for (int i = n - 1; i > 0; i--)
                a[i - 1] = a[i - 1] + a[i];
        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void close() {
            writer.close();
        }

        public void println(long i) {
            writer.println(i);
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public String nextString() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            StringBuilder res = new StringBuilder();
            do {
                if (Character.isValidCodePoint(c)) {
                    res.appendCodePoint(c);
                }
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.Vector;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        Task526C solver = new Task526C();
        solver.solve(1, in, out);
        out.close();
    }

    static class Task526C {
        public void solve(int testNumber, InputReader in, OutputWriter out) {
            String s = in.nextString();
            Vector<Integer> v = new Vector<>();
            int i, n = s.length(), cou = 0;
            long ans = 1;

            for (i = 0; i < n; i++) {
                char c = s.charAt(i);
                if (c == 'a')
                    cou++;
                else if (c == 'b' && cou != 0) {
                    v.add(cou);
                    cou = 0;
                }
            }

            if (cou != 0)
                v.add(cou);

            int m = v.size();
            for (int sa : v) {
                sa++;
                ans *= sa;
            }

            ans--;
            //out.println(a);
            out.println(ans);
        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void close() {
            writer.close();
        }

        public void println(long i) {
            writer.println(i);
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public String nextString() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            StringBuilder res = new StringBuilder();
            do {
                if (Character.isValidCodePoint(c)) {
                    res.appendCodePoint(c);
                }
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.Vector;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        Task526C solver = new Task526C();
        solver.solve(1, in, out);
        out.close();
    }

    static class Task526C {
        long ans = 1;

        public void solve(int testNumber, InputReader in, OutputWriter out) {
            String s = in.nextString();
            Vector<Integer> v = new Vector<>();
            int i, n = s.length(), cou = 0;

            for (i = 0; i < n; i++) {
                char c = s.charAt(i);
                if (c == 'a')
                    cou++;
                else if (c == 'b' && cou != 0) {
                    v.add(cou);
                    cou = 0;
                }
            }
            v.add(cou);

        /*for(int sa:v)
        {
            out.print(sa + " ");
        }*/

            int m = v.size();
            int a[] = new int[m];
            i = 0;
            for (int sa : v) {
                ans *= sa + 1;
            }
            ans--;
            //out.println(a);
            out.println(ans);
        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void close() {
            writer.close();
        }

        public void println(long i) {
            writer.println(i);
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public String nextString() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            StringBuilder res = new StringBuilder();
            do {
                if (Character.isValidCodePoint(c)) {
                    res.appendCodePoint(c);
                }
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.Vector;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        Task526C solver = new Task526C();
        solver.solve(1, in, out);
        out.close();
    }

    static class Task526C {
        public void solve(int testNumber, InputReader in, OutputWriter out) {
            String s = in.nextString();
            Vector<Integer> v = new Vector<>();
            int i, n = s.length(), cou = 0;
            long ans = 1;

            for (i = 0; i < n; i++) {
                char c = s.charAt(i);
                if (c == 'a')
                    cou++;
                else if (c == 'b' && cou != 0) {
                    v.add(cou);
                    cou = 0;
                }
            }

            if (cou != 0)
                v.add(cou);

            int m = v.size();
            for (int sa : v) {
                ans *= sa + 1;
            }
            ans--;
            //out.println(a);
            out.println(ans);
        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void close() {
            writer.close();
        }

        public void println(long i) {
            writer.println(i);
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public String nextString() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            StringBuilder res = new StringBuilder();
            do {
                if (Character.isValidCodePoint(c)) {
                    res.appendCodePoint(c);
                }
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}


import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;

public class Solution {
 public static void main(String[] args) throws Exception {
        //Scanner in = new Scanner(System.in);
        PrintWriter pw=new PrintWriter(System.out);
       BufferedReader br = new BufferedReader(
                              new InputStreamReader(System.in));
        InputReader in=new InputReader(System.in);

        char[] str=in.nextLine().toCharArray();
        int n=str.length;
        long b=0;
        long cnt=0;
        long mod=(long)1e9+7;

        for(int i=0;i<n;i++){
            if(str[i]=='a'){

                //appending current 'a' with all previously formed sequences.
                cnt=(cnt%mod +1+(b%mod))%mod;
            }else if(str[i]=='b'){
                //used for appending i.e suppose ..bbaa comes the second 'a' will also get appended to previous sequences.
                b=cnt%mod;
            }
        }

        pw.println(cnt);

        pw.flush();
        pw.close();

   }
   static class Pair implements Comparable<Pair>{
        int x;
        int y;
        Pair(int a,int b){
            x=a;
            y=b;
        }
        @Override
        public int compareTo(Pair t){
            if(x>t.x)return 1;
            else if(x==t.x){
                if(y>=t.y)return 1;
                else return -1;
            }
            else return -1;
        }
        @Override
        public boolean equals(Object obj){
            if(this==obj)return true;
            Pair that=(Pair)obj;
            if(this.x==that.x && this.y==that.y)return true;
            return false;
        }
    }
    static class InputReader {

        private final InputStream stream;
        private final byte[] buf = new byte[8192];
        private int curChar, snumChars;
        private SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int snext() {
            if (snumChars == -1)
                throw new InputMismatchException();
            if (curChar >= snumChars) {
                curChar = 0;
                try {
                    snumChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (snumChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = snext();
            while (isSpaceChar(c)) {
                c = snext();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = snext();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = snext();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public long nextLong() {
            int c = snext();
            while (isSpaceChar(c)) {
                c = snext();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = snext();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = snext();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public int[] nextIntArray(int n) {
            int a[] = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = nextInt();
            }
            return a;
        }

        public long[] nextLongArray(int n) {
            long a[] = new long[n];
            for (int i = 0; i < n; i++) {
                a[i] = nextLong();
            }
            return a;
        }

        public String readString() {
            int c = snext();
            while (isSpaceChar(c)) {
                c = snext();
            }
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = snext();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public String nextLine() {
            int c = snext();
            while (isSpaceChar(c))
                c = snext();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = snext();
            } while (!isEndOfLine(c));
            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        private boolean isEndOfLine(int c) {
            return c == '\n' || c == '\r' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);
        }
    }
}


import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;

public class Solution {
 public static void main(String[] args) throws Exception {
        //Scanner in = new Scanner(System.in);
        PrintWriter pw=new PrintWriter(System.out);
       BufferedReader br = new BufferedReader(
                              new InputStreamReader(System.in));
        InputReader in=new InputReader(System.in);

        char[] str=in.nextLine().toCharArray();
        int n=str.length;

        int[] dp=new int[n];
        if(str[n-1]=='a')dp[n-1]=1;
        else dp[n-1]=0;

        for(int i=n-2;i>=0;i--){
            if(str[i]=='a')dp[i]=dp[i+1]+1;
            else dp[i]=dp[i+1];
        }
        long cnt=dp[0];

        int l=0;
        int r=0;
        while(l<n){
            if(str[l]=='a')break;
            l++;
        }

        r=l+1;
        int f=0;
        while(l<n && r<n){
            if(str[r]=='a'){
                if(f==1){
                    cnt+=dp[r];
                    //System.out.println(cnt);
                }
                l=r;
                f=0;
            }else if(str[r]=='b')f=1;
            r++;
        }

        cnt=cnt%(long)(1e9+7);
        pw.println(cnt);

        pw.flush();
        pw.close();

   }
   static class Pair implements Comparable<Pair>{
        int x;
        int y;
        Pair(int a,int b){
            x=a;
            y=b;
        }
        @Override
        public int compareTo(Pair t){
            if(x>t.x)return 1;
            else if(x==t.x){
                if(y>=t.y)return 1;
                else return -1;
            }
            else return -1;
        }
        @Override
        public boolean equals(Object obj){
            if(this==obj)return true;
            Pair that=(Pair)obj;
            if(this.x==that.x && this.y==that.y)return true;
            return false;
        }
    }
    static class InputReader {

        private final InputStream stream;
        private final byte[] buf = new byte[8192];
        private int curChar, snumChars;
        private SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int snext() {
            if (snumChars == -1)
                throw new InputMismatchException();
            if (curChar >= snumChars) {
                curChar = 0;
                try {
                    snumChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (snumChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = snext();
            while (isSpaceChar(c)) {
                c = snext();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = snext();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = snext();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public long nextLong() {
            int c = snext();
            while (isSpaceChar(c)) {
                c = snext();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = snext();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = snext();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public int[] nextIntArray(int n) {
            int a[] = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = nextInt();
            }
            return a;
        }

        public long[] nextLongArray(int n) {
            long a[] = new long[n];
            for (int i = 0; i < n; i++) {
                a[i] = nextLong();
            }
            return a;
        }

        public String readString() {
            int c = snext();
            while (isSpaceChar(c)) {
                c = snext();
            }
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = snext();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public String nextLine() {
            int c = snext();
            while (isSpaceChar(c))
                c = snext();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = snext();
            } while (!isEndOfLine(c));
            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        private boolean isEndOfLine(int c) {
            return c == '\n' || c == '\r' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);
        }
    }
}


/*
If you want to aim high, aim high
Don't let that studying and grades consume you
Just live life young
******************************
If I'm the sun, you're the moon
Because when I go up, you go down
*******************************
I'm working for the day I will surpass you
https://www.a2oj.com/Ladder16.html
*/
import java.util.*;
import java.io.*;
import java.math.*;

   public class C
   {
      static long MOD = 1000000007L;
      public static void main(String omkar[]) throws Exception
      {
         BufferedReader infile = new BufferedReader(new InputStreamReader(System.in));
         StringTokenizer st = new StringTokenizer(infile.readLine());
         String input = st.nextToken();
         input = prune(input);
         int N = input.length();
         char[] arr = input.toCharArray();
         ArrayList<Integer> ls = new ArrayList<Integer>();
         char curr = arr[0];
         int size = 1;
         for(int i=1; i < N; i++)
         {
            if(curr == arr[i])
               size++;
            else
            {
               if(curr == 'a')
                  ls.add(size);
               curr = arr[i];
               size = 1;
            }
         }
         if(curr == 'a')
            ls.add(size);
         long res = 1L;
         for(int x: ls)
            res = (res*(x+1))%MOD;
         res--;
         res = (res+MOD)%MOD;
         System.out.println(res);
      }
      public static String prune(String input)
      {
         StringBuilder sb = new StringBuilder();
         for(char c: input.toCharArray())
            if(c == 'a' || c == 'b')
               sb.append(c);
         return sb.toString();
      }
   }


/*
If you want to aim high, aim high
Don't let that studying and grades consume you
Just live life young
******************************
If I'm the sun, you're the moon
Because when I go up, you go down
*******************************
I'm working for the day I will surpass you
https://www.a2oj.com/Ladder16.html
*/
import java.util.*;
import java.io.*;
import java.math.*;

   public class C
   {
      static long MOD = 1000000007L;
      public static void main(String omkar[]) throws Exception
      {
         BufferedReader infile = new BufferedReader(new InputStreamReader(System.in));
         StringTokenizer st = new StringTokenizer(infile.readLine());
         String input = st.nextToken();
         input = prune(input);
         int N = input.length();
         if(N == 0)
         {
            System.out.println(0);
            return;
         }
         char[] arr = input.toCharArray();
         ArrayList<Integer> ls = new ArrayList<Integer>();
         char curr = arr[0];
         int size = 1;
         for(int i=1; i < N; i++)
         {
            if(curr == arr[i])
               size++;
            else
            {
               if(curr == 'a')
                  ls.add(size);
               curr = arr[i];
               size = 1;
            }
         }
         if(curr == 'a')
            ls.add(size);
         long res = 1L;
         for(int x: ls)
            res = (res*(x+1))%MOD;
         res--;
         res = (res+MOD)%MOD;
         System.out.println(res);
      }
      public static String prune(String input)
      {
         StringBuilder sb = new StringBuilder();
         for(char c: input.toCharArray())
            if(c == 'a' || c == 'b')
               sb.append(c);
         return sb.toString();
      }
   }


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.StringTokenizer;

public class C {

    public static void main(String[] args) throws IOException {
        new C().solve();
    }

    public BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    public StringTokenizer tok = null;

    public String nextToken() throws IOException {
        if (tok == null || !tok.hasMoreTokens()) {
            tok = new StringTokenizer(reader.readLine());
        }
        return tok.nextToken();
    }

    public int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    public long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    public void solve() throws IOException {
        String s = nextToken();
        List<Long> aSums = new ArrayList<>();
        long currentASum = 0;
        for (int i = 0; i < s.length(); i++) {
            char symbol = s.charAt(i);
            switch (symbol) {
                case 'a':
                    currentASum++;
                    break;
                case 'b':
                    aSums.add(currentASum);
                    currentASum = 0;
                    break;
            }
        }
        aSums.add(currentASum);

        long answer = aSums.stream()
                .filter(x -> x > 0)
                .map(x -> x + 1)
                .reduce((a, b) -> a * b % 1_000_000_007)
                .orElse(1L);

        if (answer == 0) {
            System.out.println(1_000_000_006);
        } else {
            System.out.println(answer - 1);
        }
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.StringTokenizer;

public class C {

    public static void main(String[] args) throws IOException {
        new C().solve();
    }

    public BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    public StringTokenizer tok = null;

    public String nextToken() throws IOException {
        if (tok == null || !tok.hasMoreTokens()) {
            tok = new StringTokenizer(reader.readLine());
        }
        return tok.nextToken();
    }

    public int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    public long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    public void solve() throws IOException {
        String s = nextToken();
        List<Integer> aSums = new ArrayList<>();
        int currentASum = 0;
        for (int i = 0; i < s.length(); i++) {
            char symbol = s.charAt(i);
            switch (symbol) {
                case 'a':
                    currentASum++;
                    break;
                case 'b':
                    aSums.add(currentASum);
                    currentASum = 0;
                    break;
            }
        }
        aSums.add(currentASum);

        int answer = aSums.stream()
                .filter(x -> x > 0)
                .map(x -> x + 1)
                .reduce((a, b) -> a * b % 1_000_000_007)
                .orElse(1);

        if (answer == 0) {
            System.out.println(1_000_000_006);
        } else {
            System.out.println(answer - 1);
        }
    }
}


import java.util.*;
public class Main{
    final static long MOD = 1000000007;
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        String pattern = scan.next();
        ArrayList<Long> bucket = new ArrayList<>();
        long countA = 0;
        for (char ch: pattern.toCharArray()){
            if (ch == 'a')
                countA++;
            if (ch == 'b'){
                countA++;
                bucket.add(countA);
                countA = 0;
            }
        }
        countA++;
        bucket.add(countA);
        long product = 1;
        for (int x: bucket){
            product *= x;
            product %= MOD;
            //System.out.println(x);
        }
        product--;
        System.out.println(product);
    }
}


import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        String pattern = scan.next();
        ArrayList<Integer> bucket = new ArrayList<>();
        int countA = 0;
        for (char ch: pattern.toCharArray()){
            if (ch == 'a')
                countA++;
            if (ch == 'b'){
                countA++;
                bucket.add(countA);
                countA = 0;
            }
        }
        countA++;
        bucket.add(countA);
        int product = 1;
        for (int x: bucket){
            product *= x;
            //System.out.println(x);
        }
        product--;
        System.out.println(product);
    }
}


import java.util.*;
public class Main{
    final static long MOD = 1000000007;
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        String pattern = scan.next();
        ArrayList<Long> bucket = new ArrayList<>();
        long countA = 0;
        for (char ch: pattern.toCharArray()){
            if (ch == 'a')
                countA++;
            if (ch == 'b'){
                countA++;
                bucket.add(countA);
                countA = 0;
            }
        }
        countA++;
        bucket.add(countA);
        long product = 1;
        for (long x: bucket){
            product *= x;
            product %= MOD;
            //System.out.println(x);
        }
        product--;
        System.out.println(product);
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class B_526 {

	public static void main(String[] args) {
		FastReader scan = new FastReader();
		PrintWriter out = new PrintWriter(System.out);
		String s = scan.next();
		long count = 0;
		for(char c : s.toCharArray()) if(c == 'a') count++;
		String[] y = s.split("[b]+");
		for(int i = 0; i < y.length-1; i++) {
		    count += countA(y[i]) * countA(y[i+1]);
		}
		count %= 1_000_000_007;
		out.println(count);
		out.close();
	}

	static int countA(String s) {
	    int c = 0;
	    for(char t : s.toCharArray()) if(t == 'a') c++;
	    return c;
	}
	static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            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;
        }
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class B_526 {

	public static void main(String[] args) {
		FastReader scan = new FastReader();
		PrintWriter out = new PrintWriter(System.out);
		String s = scan.next();
		int count = 0;
		for(char c : s.toCharArray()) if(c == 'a') count++;
		String[] y = s.split("[b]+");
		for(int i = 0; i < y.length-1; i++) {
		    if(y[i].length() != 0 && y[i].charAt(y[i].length()-1) == 'b') count += y[i+1].length();
		}
		out.println(count);
		out.close();
	}
	static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            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;
        }
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class B_526 {

	public static void main(String[] args) {
		FastReader scan = new FastReader();
		PrintWriter out = new PrintWriter(System.out);
		String s = scan.next();
		long count = 0;
		for(char c : s.toCharArray()) if(c == 'a') count++;
		String[] y = s.split("[b]+");
		for(int i = 0; i < y.length-1; i++) {
		    for(int j = i + 1; j < y.length; j++) count += countA(y[i]) * countA(y[j]);
		}
		count = count % 1000000007L;
		out.println(count);
		out.close();
	}

	static long countA(String s) {
	    long c = 0;
	    for(char t : s.toCharArray()) if(t == 'a') c++;
	    return c;
	}
	static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            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;
        }
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class B_526 {

	public static void main(String[] args) {
		FastReader scan = new FastReader();
		PrintWriter out = new PrintWriter(System.out);
		String s = scan.next();
		long count = 0;
		for(char c : s.toCharArray()) if(c == 'a') count++;
		String[] y = s.split("[b]+");
		for(int i = 0; i < y.length-1; i++) {
		    count += countA(y[i]) * countA(y[i+1]);
		}
		count %= 1_000_000_007;
		out.println(count);
		out.close();
	}

	static long countA(String s) {
	    long c = 0;
	    for(char t : s.toCharArray()) if(t == 'a') c++;
	    return c;
	}
	static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            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;
        }
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class B_526 {

	public static void main(String[] args) {
		FastReader scan = new FastReader();
		PrintWriter out = new PrintWriter(System.out);
		String s = scan.next();
		int count = 0;
		for(char c : s.toCharArray()) if(c == 'a') count++;
		String[] y = s.split("[b]+");
		for(int i = 0; i < y.length-1; i++) {
		    if(y[i].length() != 0 && y[i].charAt(y[i].length()-1) == 'a') count += y[i+1].length();
		}
		out.println(count);
		out.close();
	}
	static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            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;
        }
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class B_526 {

	public static void main(String[] args) {
		FastReader scan = new FastReader();
		PrintWriter out = new PrintWriter(System.out);
		String s = scan.next();
		String[] y = s.split("[b]+");
		long ans = 1;
		for(String k : y) {
			ans *= countA(k)+1;
			ans %= 1_000_000_007L;
		}
		out.println(ans-1);
		out.close();
	}

	static long countA(String s) {
	    long c = 0;
	    for(char t : s.toCharArray()) if(t == 'a') c++;
	    return c;
	}
	static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            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;
        }
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class B_526 {

	public static void main(String[] args) {
		FastReader scan = new FastReader();
		PrintWriter out = new PrintWriter(System.out);
		String s = scan.next();
		int count = 0;
		for(char c : s.toCharArray()) if(c == 'a') count++;
		String[] y = s.split("[b]+");
		for(int i = 0; i < y.length-1; i++) {
		    if(y[i].length() != 0) count += y[i+1].length();
		}
		out.println(count);
		out.close();
	}
	static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            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;
        }
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class B_526 {

	public static void main(String[] args) {
		FastReader scan = new FastReader();
		PrintWriter out = new PrintWriter(System.out);
		String s = scan.next();
		long count = 0;
		for(char c : s.toCharArray()) if(c == 'a') count++;
		String[] y = s.split("[b]+");
		for(int i = 0; i < y.length-1; i++) {
		    for(int j = i + 1; j < y.length; j++) count += countA(y[i]) * countA(y[j]);
		}
		count = count % 1000000000L;
		out.println(count);
		out.close();
	}

	static long countA(String s) {
	    long c = 0;
	    for(char t : s.toCharArray()) if(t == 'a') c++;
	    return c;
	}
	static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            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;
        }
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class B_526 {

	public static void main(String[] args) {
		FastReader scan = new FastReader();
		PrintWriter out = new PrintWriter(System.out);
		String s = scan.next();
		long count = 0;
		for(char c : s.toCharArray()) if(c == 'a') count++;
		String[] y = s.split("[b]+");
		for(int i = 0; i < y.length-1; i++) {
		    for(int j = i + 1; j < y.length; j++) count += countA(y[i]) * countA(y[j]);
		}
		count %= 1_000_000_007;
		out.println(count);
		out.close();
	}

	static long countA(String s) {
	    long c = 0;
	    for(char t : s.toCharArray()) if(t == 'a') c++;
	    return c;
	}
	static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            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;
        }
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class B_526 {

	public static void main(String[] args) {
		FastReader scan = new FastReader();
		PrintWriter out = new PrintWriter(System.out);
		String s = scan.next();
		long count = 0;
		for(char c : s.toCharArray()) if(c == 'a') count++;
		String[] y = s.split("[b]+");
		for(int i = 0; i < y.length-1; i++) {
		    if(y[i].length() != 0 && y[i].charAt(y[i].length()-1) == 'a') count += y[i+1].length();
		}
		count %= 1_000_000_007;
		out.println(count);
		out.close();
	}
	static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            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;
        }
    }
}


//526 - Div 2 - C

import java.io.IOException;
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

    static Scanner sc = new Scanner(System.in);

    public static long calculate(String s) {
        int l = s.length();
        String s1 = "";
        long result = 1;
        ArrayList<Integer> chunks = new ArrayList<>();
        for(int i = 0; i < l; i++) {
            if(s.charAt(i) == 'a' || s.charAt(i) == 'b')
                s1 += s.charAt(i);
        }
        l = s1.length();
        int count = 0;
        for(int i = 0; i < l; i++) {
            if(s1.charAt(i) == 'a')
                count ++;
            else if(s1.charAt(i) == 'b' && count != 0) {
                chunks.add(count);
                count = 0;
            }
        }
        if(count != 0)
            chunks.add(count);
        for(int i = 0; i < chunks.size(); i++) {
            result = (result * (chunks.get(i)+1) ) % 1000000007;
        }
        //Subtracting one for empty sequence
        result -= 1;
        return result;
    }

    public static void main(String args[]) throws IOException {
        String s = sc.next();
        long result = calculate(s);
        System.out.println(result);
    }
}


//526 - Div 2 - C

import java.io.IOException;
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

    static Scanner sc = new Scanner(System.in);

    public static long calculate(String s) {
        int l = s.length();
        String s1 = s;
        long result = 1;
        ArrayList<Integer> chunks = new ArrayList<>();
//        for(int i = 0; i < l; i++) {
//            if(s.charAt(i) == 'a' || s.charAt(i) == 'b')
//                s1 += s.charAt(i);
//        }
        l = s1.length();
        int count = 0;
        for(int i = 0; i < l; i++) {
            if(s1.charAt(i) == 'a')
                count ++;
            else if(s1.charAt(i) == 'b' && count != 0) {
                chunks.add(count);
                count = 0;
            }
        }
        if(count != 0)
            chunks.add(count);
        for(int i = 0; i < chunks.size(); i++) {
            result = (result * (chunks.get(i)+1) ) % 1000000007;
        }
        //Subtracting one for empty sequence
        result -= 1;
        return result;
    }

    public static void main(String args[]) throws IOException {
        String s = sc.next();
        long result = calculate(s);
        System.out.println(result);
    }
}


package Div2;

import java.io.*;
import java.util.ArrayList;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;

public class Today {
	static long mod = (int) 1e9 + 7;

	public static void main(String[] args) throws IOException, InterruptedException {
		Scanner sc = new Scanner(System.in);
		PrintWriter pw = new PrintWriter(System.out);
		String s = sc.nextLine();
		int c = 0;
		int count=0;
		long ans = 1;
		for (int i = 0; i < s.length(); i++) {
			if (s.charAt(i) == 'a') {
				c++;
				count++;
			}
			if (s.charAt(i) == 'b' && c!=0) {
				ans = (ans * (c)) % mod;
				c = 0;
			}
		}
		ans = (ans * (c)) % mod;
//		System.out.println(ans);
		System.out.println((ans + count)%mod);
		pw.flush();
	}

	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream system) {
			br = new BufferedReader(new InputStreamReader(system));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

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

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

		public char nextChar() throws IOException {
			return next().charAt(0);
		}

		public Long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public boolean ready() throws IOException {
			return br.ready();
		}

		public void waitForInput() throws InterruptedException {
			Thread.sleep(4000);
		}
	}
}


// package Div2;

import java.io.*;
import java.util.ArrayList;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;

public class Today {
	static long mod = (int) 1e9 + 7;

	public static void main(String[] args) throws IOException, InterruptedException {
		Scanner sc = new Scanner(System.in);
		PrintWriter pw = new PrintWriter(System.out);
		String s = sc.nextLine();
		int c = 0;
		int count=0;
		long ans = 1;
		for (int i = 0; i < s.length(); i++) {
			if (s.charAt(i) == 'a') {
				c++;
				count++;
			}
			if (s.charAt(i) == 'b' && c!=0) {
				ans = (ans * (c)) % mod;
				c = 0;
			}
		}
		ans = (ans * (c)) % mod;
//		System.out.println(ans);
		System.out.println((ans + count)%mod);
		pw.flush();
	}

	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream system) {
			br = new BufferedReader(new InputStreamReader(system));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

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

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

		public char nextChar() throws IOException {
			return next().charAt(0);
		}

		public Long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public boolean ready() throws IOException {
			return br.ready();
		}

		public void waitForInput() throws InterruptedException {
			Thread.sleep(4000);
		}
	}
}


// package Div2;

import java.io.*;
import java.util.ArrayList;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;

public class Today {
	static long mod = (int) 1e9 + 7;

	public static void main(String[] args) throws IOException, InterruptedException {
		Scanner sc = new Scanner(System.in);
		PrintWriter pw = new PrintWriter(System.out);
		String s = sc.nextLine();
		int c = 0;
		int count=0;
		long ans = 1;
		int seq=0;
		boolean f=false;
		for (int i = 0; i < s.length(); i++) {
			if (s.charAt(i) == 'a') {
				c++;
				count++;
				if(!f)
				{
					seq++;
					f=!f;
				}
			}
			if (s.charAt(i) == 'b' && c!=0) {
				ans = (ans * (c)) % mod;
				c = 0;
				if(f)
					f=!f;
			}
		}
		if(c>0)
			ans = (ans * (c)) % mod;
//		System.out.println(ans);
		if(seq>1)
			ans+=count;
		System.out.println((ans)%mod);
		pw.flush();
	}

	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream system) {
			br = new BufferedReader(new InputStreamReader(system));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

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

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

		public char nextChar() throws IOException {
			return next().charAt(0);
		}

		public Long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public boolean ready() throws IOException {
			return br.ready();
		}

		public void waitForInput() throws InterruptedException {
			Thread.sleep(4000);
		}
	}
}


// package Div2;

import java.io.*;
import java.util.ArrayList;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;

public class Today {
	static long mod = (int) 1e9 + 7;

	public static void main(String[] args) throws IOException, InterruptedException {
		Scanner sc = new Scanner(System.in);
		PrintWriter pw = new PrintWriter(System.out);
		String s = sc.nextLine();
		int c = 0;
		int count=0;
		long ans = 1;
		int seq=0;
		boolean f=false;
		for (int i = 0; i < s.length(); i++) {
			if (s.charAt(i) == 'a') {
				c++;
				count++;
				if(!f)
				{
					seq++;
					f=!f;
				}
			}
			if (s.charAt(i) == 'b' && c!=0) {
				ans = (ans * (c)) % mod;
				c = 0;
				if(f)
					f=!f;
			}
		}
		ans = (ans * (c)) % mod;
//		System.out.println(ans);
		if(seq>1)
			ans+=count;
		System.out.println((ans)%mod);
		pw.flush();
	}

	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream system) {
			br = new BufferedReader(new InputStreamReader(system));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

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

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

		public char nextChar() throws IOException {
			return next().charAt(0);
		}

		public Long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public boolean ready() throws IOException {
			return br.ready();
		}

		public void waitForInput() throws InterruptedException {
			Thread.sleep(4000);
		}
	}
}


import java.io.*;
import java.util.ArrayList;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;

public class Today {
	static long mod = (int) 1e9 + 7;

	public static void main(String[] args) throws IOException, InterruptedException {
		Scanner sc = new Scanner(System.in);
		PrintWriter pw = new PrintWriter(System.out);
		String s = sc.nextLine();
		int c = 0;
		long ans = 1;
		for (int i = 0; i < s.length(); i++) {
			if (s.charAt(i) == 'a')
				c++;
			if (s.charAt(i) == 'b') {
				ans = (ans * (c + 1)) % mod;
				c = 0;
			}
		}
		ans = (ans * (c + 1)) % mod;
		System.out.println(ans - 1);
		pw.flush();
	}

	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream system) {
			br = new BufferedReader(new InputStreamReader(system));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

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

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

		public char nextChar() throws IOException {
			return next().charAt(0);
		}

		public Long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public boolean ready() throws IOException {
			return br.ready();
		}

		public void waitForInput() throws InterruptedException {
			Thread.sleep(4000);
		}
	}
}


import java.io.*;
import java.util.ArrayList;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;

public class Today {
	static long mod = (int) 1e9 + 7;

	public static void main(String[] args) throws IOException, InterruptedException {
		Scanner sc = new Scanner(System.in);
		PrintWriter pw = new PrintWriter(System.out);
		String s = sc.nextLine();
		TreeSet<Integer> bs = new TreeSet<>();
		TreeSet<Integer> as = new TreeSet<>();
		int maxA = -1;
		for (int i = 0; i < s.length(); i++) {
			if (s.charAt(i) == 'b')
				bs.add(i);
			if (s.charAt(i) == 'a') {
				as.add(i);
				maxA = i;
			}
		}
		int arr[] = new int[s.length()];
		int arrB[] = new int[s.length()];
		int countB = 1;
		arr[0] = s.charAt(s.length() - 1) == 'a' ? 1 : 0;
		int count = arr[0] + 1;
		for (int i = s.length() - 2; i >= 0; i--) {
			if (s.charAt(i) == 'a')
				arr[i] = count++;
			if (s.charAt(i) != 'a')
				arr[i] = arr[i + 1];
			if (s.charAt(i) == 'b')
				arrB[i] = count++;
		}
		long ans = as.size();
		ArrayList<Integer> ass = new ArrayList<>(as);
		int size = as.size();
		for (int i = 0; i < size; i++) {
			if (bs.higher(as.first()) == null)
				continue;
			int firstB = bs.higher(as.first());
			int x = as.first();
			int z = as.higher(firstB);
			as.remove(x);
			int lastA = as.last();
			int countt = arr[z - 1] - arr[lastA];
			if (firstB > x) {
				if (i != lastA) {
					ans = (ans + countt) % mod;
					// System.out.println(i + " " + firstB + " " + lastA + " " + arr[x] + " " +
					// arr[lastA]);
				}
			}
		}
		pw.println(ans);
		pw.flush();
	}

	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream system) {
			br = new BufferedReader(new InputStreamReader(system));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

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

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

		public char nextChar() throws IOException {
			return next().charAt(0);
		}

		public Long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public boolean ready() throws IOException {
			return br.ready();
		}

		public void waitForInput() throws InterruptedException {
			Thread.sleep(4000);
		}
	}
}


import java.util.*;
import java.io.*;
import java.util.Queue;
import java.util.LinkedList;
import java.math.*;

     public class Solution implements Runnable
    {

          public  static void solve()
          {
            String s = s();
            char[] c = s.toCharArray();
            String a = "";
            for(int i=0;i<c.length;i++) {
              if(c[i]=='a' ||  c[i]== 'b')a += c[i];
              else continue;
            }

            long ans = 1;
            long count = 0;
            for(int i=0;i<a.length();i++){
              if(a.charAt(i) == 'b') {
                ans = (ans%mod * (count+1)%mod)%mod;
                count = 0;
              } else {
                count++;
               }

            }
            ans = (ans%mod * (count+1)%mod)%mod;
            System.out.println(ans-1);

          }

          public void run()
          {
              solve();
              out.close();
          }

          public static void main(String[] args) throws IOException
          {
                new Thread(null, new Solution(), "whatever", 1<<26).start();
          }
         abstract static class Pair implements Comparable<Pair>
         {
            long a;
            int b;

            Pair(){}
            Pair(long a,int b)
            {
                       this.a=a;
                       this.b=b;
            }

            public int compareTo(Pair x)
           {
                return Long.compare(x.a,this.a);
           }
        }

    ////////////////////////////////////////////////////// Merge Sort ////////////////////////////////////////////////////////////////////////

   static class Merge
   {

        public static void sort(long inputArr[])
        {
            int length = inputArr.length;
            doMergeSort(inputArr,0, length - 1);
        }

        private static void doMergeSort(long[] arr,int lowerIndex, int higherIndex)
        {
            if (lowerIndex < higherIndex) {
                int middle = lowerIndex + (higherIndex - lowerIndex) / 2;
                doMergeSort(arr,lowerIndex, middle);
                doMergeSort(arr,middle + 1, higherIndex);
                mergeParts(arr,lowerIndex, middle, higherIndex);
            }
        }

        private static void mergeParts(long[]array,int lowerIndex, int middle, int higherIndex)
        {
            long[] temp=new long[higherIndex-lowerIndex+1];
            for (int i = lowerIndex; i <= higherIndex; i++)
            {
                temp[i-lowerIndex] = array[i];
            }
            int i = lowerIndex;
            int j = middle + 1;
            int k = lowerIndex;
            while (i <= middle && j <= higherIndex)
            {
                if (temp[i-lowerIndex] < temp[j-lowerIndex])
                {
                    array[k] = temp[i-lowerIndex];
                    i++;
                } else {
                    array[k] = temp[j-lowerIndex];
                    j++;
                }
                k++;
            }
            while (i <= middle)
            {
                array[k] = temp[i-lowerIndex];
                k++;
                i++;
            }
            while(j<=higherIndex)
            {
                array[k]=temp[j-lowerIndex];
                k++;
                j++;
            }
        }

    }

    /////////////////////////////////////////////////////////// Methods ////////////////////////////////////////////////////////////////////////

     static boolean isPal(String s)
     {
        for(int i=0, j=s.length()-1;i<=j;i++,j--)
        {
                if(s.charAt(i)!=s.charAt(j)) return false;
        }
        return true;
     }
     static String rev(String s)
     {
                StringBuilder sb=new StringBuilder(s);
                sb.reverse();
                return sb.toString();
     }
     static int gcd(int a,int b){return (a==0)?b:gcd(b%a,a);}
     static long gcdExtended(long a,long b,long[] x)
     {

        if(a==0){
            x[0]=0;
            x[1]=1;
            return b;
        }
        long[] y=new long[2];
        long gcd=gcdExtended(b%a, a, y);

        x[0]=y[1]-(b/a)*y[0];
        x[1]=y[0];

        return gcd;
    }

     boolean findSum(int set[], int n, long sum)
    {
      if (sum == 0)
         return true;
      if (n == 0 && sum != 0)
         return false;
      if (set[n-1] > sum)
         return findSum(set, n-1, sum);
      return findSum(set, n-1, sum) ||findSum(set, n-1, sum-set[n-1]);
    }

      public static long modPow(long base, long exp, long mod)
     {
        base = base % mod;
        long result = 1;
        while (exp > 0)
       {
            if (exp % 2 == 1)
            {
                result = (result * base) % mod;
            }
            base = (base * base) % mod;
            exp = exp >> 1;
       }
        return result;
    }

    static long[] fac;
    static long[] inv;
    static long mod=(long)1e9+7;
    public static void cal()
    {
        fac = new long[1000005];
        inv = new long[1000005];
        fac[0] = 1;
        inv[0] = 1;
        for (int i = 1; i <= 1000000; i++)
        {
            fac[i] = (fac[i - 1] * i) % mod;
            inv[i] = (inv[i - 1] * modPow(i, mod - 2, mod)) % mod;
        }
    }

    public static long ncr(int n, int r)
    {
        return (((fac[n] * inv[r]) % mod) * inv[n - r]) % mod;
    }

////////////////////////////////////////// Input Reader ////////////////////////////////////////////////////////////////////////////////////////////////////

    static InputReader sc = new InputReader(System.in);
    static PrintWriter out= new PrintWriter(System.out);

    static class InputReader {

          private final InputStream stream;
          private final byte[] buf = new byte[8192];
          private int curChar, snumChars;
          private SpaceCharFilter filter;

          public InputReader(InputStream stream) {
                  this.stream = stream;
          }

          public int snext()
         {
                  if (snumChars == -1)
                          throw new InputMismatchException();
                  if (curChar >= snumChars) {
                          curChar = 0;
                          try {
                                  snumChars = stream.read(buf);
                          } catch (IOException e) {
                                  throw new InputMismatchException();
                          }
                          if (snumChars <= 0)
                                  return -1;
                  }
                  return buf[curChar++];
          }

          public int nextInt()
         {
                  int c = snext();
                  while (isSpaceChar(c))
                  {
                          c = snext();
                  }
                  int sgn = 1;
                  if (c == '-')
                  {
                          sgn = -1;
                          c = snext();
                  }
                  int res = 0;
                  do {
                          if (c < '0' || c > '9')
                                  throw new InputMismatchException();
                          res *= 10;
                          res += c - '0';
                          c = snext();
                  } while (!isSpaceChar(c));
                  return res * sgn;
          }

          public long nextLong()
          {
                  int c = snext();
                  while (isSpaceChar(c))
                  {
                          c = snext();
                  }
                  int sgn = 1;
                  if (c == '-')
                  {
                          sgn = -1;
                          c = snext();
                  }
                  long res = 0;
                  do {
                          if (c < '0' || c > '9')
                                  throw new InputMismatchException();
                          res *= 10;
                          res += c - '0';
                          c = snext();
                  } while (!isSpaceChar(c));
                  return res * sgn;
          }

          public int[] nextIntArray(int n)
          {
                  int a[] = new int[n];
                  for (int i = 0; i < n; i++)
                  {
                          a[i] = nextInt();
                  }
                  return a;
          }

          public long[] nextLongArray(int n)
          {
                  long a[] = new long[n];
                  for (int i = 0; i < n; i++)
                  {
                          a[i] = nextLong();
                  }
                  return a;
          }

          public String nextLine()
         {
                  int c = snext();
                  while (isSpaceChar(c))
                          c = snext();
                  StringBuilder res = new StringBuilder();
                  do {
                          res.appendCodePoint(c);
                          c = snext();
                  } while (!isEndOfLine(c));
                  return res.toString();
          }

          public boolean isSpaceChar(int c)
          {
                  if (filter != null)
                          return filter.isSpaceChar(c);
                  return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
          }

          private boolean isEndOfLine(int c)
          {
                  return c == '\n' || c == '\r' || c == -1;
          }

          public interface SpaceCharFilter
          {
                  public boolean isSpaceChar(int ch);
          }

    }

    static int i()
    {
        return sc.nextInt();
    }
    static long l(){
        return sc.nextLong();
    }
    static int[] iarr(int n)
    {
        return sc.nextIntArray(n);
    }
    static long[] larr(int n)
    {
        return sc.nextLongArray(n);
    }
    static String s(){
        return sc.nextLine();
    }

 }