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 a = s();

            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 if (a.charAt(i) == 'a') {
                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();
    }

 }


import java.util.*;
import java.io.*;
import java.lang.*;
import java.math.*;

public class the_fair_nut_and_string {
	public void run() throws Exception {
		FastScanner file = new FastScanner();
		char[] c = file.nextLine().toCharArray();
		int n = c.length;
		long[] dp = new long[n+1];
		long[] sum = new long[n+1];
		long mod = (long)10e9+7L;
		int bind = 0;
		sum[0] = 1;
		dp[0] = 1;
		for (int i = 0; i < n; i++) {
			if (c[i]=='b') bind = i+1;
			else if (c[i]=='a') dp[i+1] = sum[bind];
			sum[i+1] = (sum[i]+dp[i+1]) % mod;
		}
		System.out.println(sum[n]-1);
	}

	static class FastScanner {
		public BufferedReader reader;
		public StringTokenizer tokenizer;

		public FastScanner() {
			reader = new BufferedReader(new InputStreamReader(System.in), 32768);
			tokenizer = null;
		}

		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}

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

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

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

		public String nextLine() {
			try {
				return reader.readLine();
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}

	}

	public static void main(String[] args) throws Exception {
		new the_fair_nut_and_string().run();
	}
}


import java.util.*;
import java.io.*;
import java.lang.*;
import java.math.*;

public class the_fair_nut_and_string {
	public void run() throws Exception {
		FastScanner file = new FastScanner();
		char[] c = file.nextLine().toCharArray();
		int n = c.length;
		long[] dp = new long[n+1];
		long[] sum = new long[n+1];
		long mod = (long)10e9+7L;
		int bind = 0;
		sum[0] = 1;
		dp[0] = 1;
		for (int i = 0; i < n; i++) {
			if (c[i]=='b') bind = i+1;
			else if (c[i]=='a') dp[i+1] = sum[bind];
			sum[i+1] = (sum[i]%mod+dp[i+1]%mod) % mod;
		}
		System.out.println(sum[n]-1);
	}

	static class FastScanner {
		public BufferedReader reader;
		public StringTokenizer tokenizer;

		public FastScanner() {
			reader = new BufferedReader(new InputStreamReader(System.in), 32768);
			tokenizer = null;
		}

		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}

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

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

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

		public String nextLine() {
			try {
				return reader.readLine();
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}

	}

	public static void main(String[] args) throws Exception {
		new the_fair_nut_and_string().run();
	}
}


import java.util.*;
import java.io.*;
import java.lang.*;
import java.math.*;

public class the_fair_nut_and_string {
	public void run() throws Exception {
		FastScanner file = new FastScanner();
		char[] c = file.nextLine().trim().toCharArray();
		int n = c.length;
		long[] dp = new long[n+1];
		long[] sum = new long[n+1];
		long mod = 1000000007;
		int bind = 0;
		sum[0] = 1;
		dp[0] = 1;
		for (int i = 0; i < n; i++) {
			if (c[i]=='b') bind = i+1;
			else if (c[i]=='a') dp[i+1] = sum[bind];
			sum[i+1] = (sum[i]%mod+dp[i+1]%mod) % mod;
		}
		System.out.println(sum[n]-1);
	}

	static class FastScanner {
		public BufferedReader reader;
		public StringTokenizer tokenizer;

		public FastScanner() {
			reader = new BufferedReader(new InputStreamReader(System.in), 32768);
			tokenizer = null;
		}

		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}

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

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

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

		public String nextLine() {
			try {
				return reader.readLine();
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}

	}

	public static void main(String[] args) throws Exception {
		new the_fair_nut_and_string().run();
	}
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author shanky_ty
*/public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		Scanner in = new Scanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskC solver = new TaskC();
		solver.solve(1, in, out);
		out.close();
	}
static class TaskC   {
public void solve(int testNumber, Scanner in, PrintWriter out) {
        String n = in.nextLine();
        long mod = 1000000007;
        long res = 1;
        long cnt = 0;
        for (int i = 0; i < n.length(); i++) {
            if (n.charAt(i) == 'a') {
                cnt++;
            } else if (n.charAt(i) == 'b') {
                res = (res * ((cnt + 1) % mod)) % mod;
                cnt = 0;
            }
        }
        if (cnt > 0) {
            res = (res * ((cnt + 1) % mod)) % mod;
        }
        out.write(Long.toString((res % mod - 1 % mod) % mod));
    }

}
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author shanky_ty
*/public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		Scanner in = new Scanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskC solver = new TaskC();
		solver.solve(1, in, out);
		out.close();
	}
static class TaskC   {
public void solve(int testNumber, Scanner in, PrintWriter out) {
        String n = in.nextLine();
        int mod = 1000000007;
        int res = 1;
        int cnt = 0;
        for (int i = 0; i < n.length(); i++) {
            if (n.charAt(i) == 'a') {
                cnt++;
            } else if (n.charAt(i) == 'b') {
                res = res * (cnt + 1);
                cnt = 0;
            }
        }
        if (cnt > 0) {
            res = (res % mod * (cnt + 1) % mod) % mod;
        }
        out.write(Integer.toString(res - 1));
    }

}
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author shanky_ty
*/public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		Scanner in = new Scanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskC solver = new TaskC();
		solver.solve(1, in, out);
		out.close();
	}
static class TaskC   {
public void solve(int testNumber, Scanner in, PrintWriter out) {
        String n = in.nextLine();
        long mod = 1000000007;
        long res = 1;
        long cnt = 0;
        for (int i = 0; i < n.length(); i++) {
            if (n.charAt(i) == 'a') {
                cnt++;
            } else if (n.charAt(i) == 'b') {
                res = res * (cnt + 1);
                cnt = 0;
            }
        }
        if (cnt > 0) {
            res = ((res % mod) * ((cnt + 1) % mod)) % mod;
        }
        out.write(Long.toString((res % mod - 1 % mod) % mod));
    }

}
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

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

    static class TaskC {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            String n = in.nextLine();
            int mod = 1000000007;
            int res = 1;
            int cnt = 0;
            for (int i = 0; i < n.length(); i++) {
                if (n.charAt(i) == 'a') {
                    cnt++;
                } else if (n.charAt(i) == 'b') {
                    res = res * (cnt + 1);
                    cnt = 0;
                }
            }
            if (cnt > 0) {
                res = ((res % mod) * ((cnt + 1) % mod)) % mod;
            }
            out.write(Integer.toString((res % mod - 1 % mod) % mod));
        }

    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author shanky_ty
*/public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		Scanner in = new Scanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskC solver = new TaskC();
		solver.solve(1, in, out);
		out.close();
	}
static class TaskC   {
public void solve(int testNumber, Scanner in, PrintWriter out) {
        String n = in.nextLine();
        int mod = 1000000007;
        int res = 1;
        int cnt = 0;
        for (int i = 0; i < n.length(); i++) {
            if (n.charAt(i) == 'a') {
                cnt++;
            } else if (n.charAt(i) == 'b') {
                res = res * (cnt + 1);
                cnt = 0;
            }
        }
        if (cnt > 0) {
            res = (res % mod * (cnt + 1) % mod) % mod;
        }
        out.write(Integer.toString((res%mod - 1%mod)%mod));
    }

}
}


import java.util.*;
import java.lang.*;
import java.io.*;
public class Main
{
    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;
        }
    }
    static FastReader s = new FastReader();
    public static void solve(){
        char[] s1 = s.nextLine().toCharArray();
        char[] a = new char[s1.length];
        int index =0;
        int mod = (int)1e9+7;
        for(int i=0;i<s1.length;i++){
            if(s1[i]=='a' || s1[i]=='b'){
                a[index]=s1[i];
                index++;
            }
        }
        Long ans = 1L;
        int count = 0;
        for(int i=0;i<index;i++){
            if(a[i]=='b' && count!=0){
                ans = (ans*(count+1))%mod;
                count = 0;
            }
            else if(a[i]=='a'){
                count++;
            }
        }
        if(count!=0)
            ans = (ans*(count+1))%mod;
        System.out.println(ans-1);

    }
    public static void main(String[] args)
    {
        int T=1;
        // int T = s.nextInt();
        while(T>0){
            // System.out.println("TEST CASE: "+T);
            solve();
            T--;
        }
    }
}


import java.util.*;
import java.lang.*;
import java.io.*;
public class Main
{
    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;
        }
    }
    static FastReader s = new FastReader();
    public static void solve(){
        char[] s1 = s.nextLine().toCharArray();
        char[] a = new char[s1.length];
        int index =0;
        int mod = (int)1e9+7;
        for(int i=0;i<s1.length;i++){
            if(s1[i]=='a' || s1[i]=='b'){
                a[index]=s1[i];
                index++;
            }
        }
        Long ans = 1L;
        int count = 0;
        for(int i=0;i<index;i++){
            if(a[i]=='b' && count!=0){
                ans = (ans*(count+1))%mod;
                count = 0;
            }
            else if(a[i]=='a'){
                count++;
            }
        }
        if(count!=0)
            ans = ans*(count+1);
        System.out.println(ans-1);

    }
    public static void main(String[] args)
    {
        int T=1;
        // int T = s.nextInt();
        while(T>0){
            // System.out.println("TEST CASE: "+T);
            solve();
            T--;
        }
    }
}


import java.util.*;
import java.lang.*;
import java.io.*;
public class Main
{
    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;
        }
    }
    static FastReader s = new FastReader();
    public static void solve(){
        char[] s1 = s.nextLine().toCharArray();
        char[] a = new char[s1.length];
        int index =0;
        for(int i=0;i<s1.length;i++){
            if(s1[i]=='a' || s1[i]=='b'){
                a[index]=s1[i];
                index++;
            }
        }
        Long ans = 1L;
        int count = 0;
        for(int i=0;i<index;i++){
            if(a[i]=='b' && count!=0){
                ans = ans*(count+1);
                count = 0;
            }
            else if(a[i]=='a'){
                count++;
            }
        }
        if(count!=0)
            ans = ans*(count+1);
        System.out.println(ans-1);

    }
    public static void main(String[] args)
    {
        int T=1;
        // int T = s.nextInt();
        while(T>0){
            // System.out.println("TEST CASE: "+T);
            solve();
            T--;
        }
    }
}


import java.util.*;
import java.lang.*;
import java.io.*;
public class Main
{
    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;
        }
    }
    static FastReader s = new FastReader();
    public static void solve(){
        char[] s1 = s.nextLine().toCharArray();
        char[] a = new char[s1.length];
        int index =0;
        for(int i=0;i<s1.length;i++){
            if(s1[i]=='a' || s1[i]=='b'){
                a[index]=s1[i];
                index++;
            }
        }
        int ans = 1;
        int count = 0;
        for(int i=0;i<index;i++){
            if(a[i]=='b' && count!=0){
                ans = ans*(count+1);
                count = 0;
            }
            else if(a[i]=='a'){
                count++;
            }
        }
        if(count!=0)
            ans = ans*(count+1);
        System.out.println(ans-1);

    }
    public static void main(String[] args)
    {
        int T=1;
        // int T = s.nextInt();
        while(T>0){
            // System.out.println("TEST CASE: "+T);
            solve();
            T--;
        }
    }
}


import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.*;

public class TheFairNutAndString {

	public static void main(String args[])
	{
		Scanner sc = new Scanner(System.in);
		String str = sc.next();

		BigInteger numOfSets = new BigInteger("0");

		int firstPointer = 0;
		int lastPointer = str.length()-1;

		int left[] = new int[str.length()];
		int right[] = new int[str.length()];

		for(int i=1;i<str.length();i++)
		{
			left[i] = left[i-1];
			if(str.charAt(i-1) == 'a')
			{
				left[i] += 1;
			}
		}

		for(int i=str.length()-2;i>=0;i--)
		{
			right[i] = right[i+1];
			if(str.charAt(i+1) == 'a')
			{
				right[i] += 1;
			}
		}

		int numOfA = right[0];
		if(str.charAt(0) == 'a')
			numOfA += 1;

		numOfSets = numOfSets.add(BigInteger.valueOf(numOfA));

		ArrayList<Integer> indexesOfB = new ArrayList<>();

		for(int i=0 ; i<str.length(); i++)
		{
			if(str.charAt(i) == 'b')
			{
				indexesOfB.add(i);
			}
		}

		ArrayList<Integer> sections = new ArrayList<>();

		for(int i = 0;i<indexesOfB.size();i++)
		{
			int index = indexesOfB.get(i);

			if(i == 0)
			{
				int leftSec = left[index];
				if(leftSec != 0)
					sections.add(leftSec);
			}

			int rightSec = right[index];

			if(i != indexesOfB.size()-1)
			{
				int nextIndex = indexesOfB.get(i+1);
				rightSec -= right[nextIndex];
			}

			if(rightSec!=0)
			{
				sections.add(rightSec);
			}
		}

		long result = 1;
		long sum = 0;

		for(int i = 0; i<sections.size();i++)
		{
			result = result * (sections.get(i)+1);
			sum += sections.get(i);
		}

		int modulo = 1000000007;

		numOfSets = numOfSets.add(BigInteger.valueOf(result));
		numOfSets = numOfSets.subtract(BigInteger.valueOf(sum+1));
		System.out.println(numOfSets);
	}
}


import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.*;

public class TheFairNutAndString {

	public static void main(String args[])
	{
		Scanner sc = new Scanner(System.in);
		String str = sc.next();

		BigInteger numOfSets = new BigInteger("0");

		int left[] = new int[str.length()];
		int right[] = new int[str.length()];

		for(int i=1;i<str.length();i++)
		{
			left[i] = left[i-1];
			if(str.charAt(i-1) == 'a')
			{
				left[i] += 1;
			}
		}

		for(int i=str.length()-2;i>=0;i--)
		{
			right[i] = right[i+1];
			if(str.charAt(i+1) == 'a')
			{
				right[i] += 1;
			}
		}

		int numOfA = right[0];
		if(str.charAt(0) == 'a')
			numOfA += 1;

		numOfSets = numOfSets.add(BigInteger.valueOf(numOfA));

		ArrayList<Integer> indexesOfB = new ArrayList<>();

		for(int i=0 ; i<str.length(); i++)
		{
			if(str.charAt(i) == 'b')
			{
				indexesOfB.add(i);
			}
		}

		ArrayList<Integer> sections = new ArrayList<>();

		for(int i = 0;i<indexesOfB.size();i++)
		{
			int index = indexesOfB.get(i);

			if(i == 0)
			{
				int leftSec = left[index];
				if(leftSec != 0)
					sections.add(leftSec);
			}

			int rightSec = right[index];

			if(i != indexesOfB.size()-1)
			{
				int nextIndex = indexesOfB.get(i+1);
				rightSec -= right[nextIndex];
			}

			if(rightSec!=0)
			{
				sections.add(rightSec);
			}
		}

		BigInteger result = BigInteger.ONE;
		long sum = 0;

		for(int i = 0; i<sections.size();i++)
		{
			result = result.multiply(BigInteger.valueOf(sections.get(i)+1));
			sum += sections.get(i);
		}

		int modulo = 1000000007;

		numOfSets = numOfSets.add(result);
		numOfSets = numOfSets.subtract(BigInteger.valueOf(sum+1));
		System.out.println(numOfSets.mod(BigInteger.valueOf(modulo)));
	}
}


import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.*;

public class TheFairNutAndString {

	public static void main(String args[])
	{
		Scanner sc = new Scanner(System.in);
		String str = sc.next();

		BigInteger numOfSets = new BigInteger("0");

		int firstPointer = 0;
		int lastPointer = str.length()-1;

		int left[] = new int[str.length()];
		int right[] = new int[str.length()];

		for(int i=1;i<str.length();i++)
		{
			left[i] = left[i-1];
			if(str.charAt(i-1) == 'a')
			{
				left[i] += 1;
			}
		}

		for(int i=str.length()-2;i>=0;i--)
		{
			right[i] = right[i+1];
			if(str.charAt(i+1) == 'a')
			{
				right[i] += 1;
			}
		}

		int numOfA = right[0];
		if(str.charAt(0) == 'a')
			numOfA += 1;

		numOfSets = numOfSets.add(BigInteger.valueOf(numOfA));

		ArrayList<Integer> indexesOfB = new ArrayList<>();

		for(int i=0 ; i<str.length(); i++)
		{
			if(str.charAt(i) == 'b')
			{
				indexesOfB.add(i);
			}
		}

		ArrayList<Integer> sections = new ArrayList<>();

		for(int i = 0;i<indexesOfB.size();i++)
		{
			int index = indexesOfB.get(i);

			if(i == 0)
			{
				int leftSec = left[index];
				if(leftSec != 0)
					sections.add(leftSec);
			}

			int rightSec = right[index];

			if(i != indexesOfB.size()-1)
			{
				int nextIndex = indexesOfB.get(i+1);
				rightSec -= right[nextIndex];
			}

			if(rightSec!=0)
			{
				sections.add(rightSec);
			}
		}

		long result = 1;
		long sum = 0;

		for(int i = 0; i<sections.size();i++)
		{
			result = result * (sections.get(i)+1);
			sum += sections.get(i);
		}

		int modulo = 1000000007;

		numOfSets = numOfSets.add(BigInteger.valueOf(result));
		numOfSets = numOfSets.subtract(BigInteger.valueOf(sum+1));
		System.out.println(numOfSets.mod(BigInteger.valueOf(modulo)));
	}
}


import java.util.Scanner;

public class Main {

    public static final long  MOD = 1000000007L;

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        long[] dp = new long[100005];
        while (scanner.hasNext()) {
            String input = scanner.nextLine();
            int lastBucket = -1, lastA = -1;
            long ans = 0L;
            for (int i = 0; i < input.length(); i ++)
            {
                dp[i] = 0;
                if (input.charAt(i) == 'a') {
                    if (lastBucket < 0) {
                        dp[i] = i == 0 ? 1 : dp[i-1] + 1;
                    } else {
                        dp[i] = dp[lastBucket] + 1 + dp[i-1];
                    }
                    dp[i] = dp[i] % MOD;
                    lastA = i;
                } else if(input.charAt(i) == 'b') {
                    if (lastBucket != lastA) {
                        lastBucket = lastA;
                    }
                    dp[i] = i == 0 ? 0: dp[i-1];
                } else {
                    dp[i] = i == 0 ? 0: dp[i-1];
                }
            }
            System.out.println(dp[input.length()-1]);
        }
    }
}


import java.util.Scanner;

public class Main {

    public static final long  MOD = 100000007L;

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        long[] dp = new long[100005];
        while (scanner.hasNext()) {
            String input = scanner.nextLine();
            int lastBucket = -1, lastA = -1;
            long ans = 0L;
            for (int i = 0; i < input.length(); i ++)
            {
                dp[i] = 0;
                if (input.charAt(i) == 'a') {
                    if (lastBucket < 0) {
                        dp[i] = i == 0 ? 1 : dp[i-1] + 1;
                    } else {
                        dp[i] = dp[lastBucket] + 1 + dp[i-1];
                    }
                    dp[i] = dp[i] % MOD;
                    lastA = i;
                } else if(input.charAt(i) == 'b') {
                    if (lastBucket != lastA) {
                        lastBucket = lastA;
                    }
                    dp[i] = i == 0 ? 0: dp[i-1];
                } else {
                    dp[i] = i == 0 ? 0: dp[i-1];
                }
            }
            System.out.println(dp[input.length()-1]);
        }
    }
}


import java.util.*;
import java.io.*;
public class C1084 {
	static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	static PrintWriter pr = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
	static StringTokenizer st;
	static long mod = (long)1e9+7;
	public static void main(String[]args)throws IOException {
		String s = next();
		ArrayList<Integer>list = new ArrayList<Integer>();
		int count = 0;
		for(int i = 0; i<s.length(); i++) {
			if(s.charAt(i)=='a') {
				count++;
			}
			if(s.charAt(i)=='b') {
				if(count>0)
				list.add(count);
				count = 0;
			}
		}
		if(count>0) list.add(count);
		long[]array= new long[list.size()+1];
		for(int i = 0; i<list.size(); i++) {
			array[i+1] = list.get(i);
		}
		array[0] = 1;
		long ans = 0;
		for(int i = 1; i<=list.size(); i++) {
			long prod = 1;
			for(int j = i; j<=list.size(); j++) {
				prod*=array[j];
				prod%=mod;
				ans+=prod;
				ans%=mod;
			}
		}
		pr.println(ans%mod);
		pr.close();
	}
	static String next () throws IOException {
		while (st == null || !st.hasMoreTokens())
			st = new StringTokenizer(br.readLine().trim());
		return st.nextToken();
	}
	static long readLong () throws IOException {
		return Long.parseLong(next());
	}
	static int readInt () throws IOException {
		return Integer.parseInt(next());
	}
	static double readDouble () throws IOException {
		return Double.parseDouble(next());
	}
	static char readCharacter () throws IOException {
		return next().charAt(0);
	}
	static String readLine () throws IOException {
		return br.readLine().trim();
	}
}


import java.util.*;
import java.io.*;
public class C1084 {
	static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	static PrintWriter pr = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
	static StringTokenizer st;
	static long mod = (long)1e9+7;
	public static void main(String[]args)throws IOException {
		String s = next();
		ArrayList<Integer>list = new ArrayList<Integer>();
		int count = 0;
		for(int i = 0; i<s.length(); i++) {
			if(s.charAt(i)=='a') {
				count++;
			}
			if(s.charAt(i)=='b') {
				if(count>0)
				list.add(count);
				count = 0;
			}
		}
		if(count>0) list.add(count);
		long[]array= new long[list.size()+1];
		for(int i = 0; i<list.size(); i++) {
			array[i+1] = list.get(i);
		}
		array[0] = 1;
		long prod = 1;
		for(int i = 1; i<=list.size(); i++) {
			prod = (prod*array[i]+prod)%mod;
		}
		prod--;
		pr.println(prod%mod);
		pr.close();
	}
	static String next () throws IOException {
		while (st == null || !st.hasMoreTokens())
			st = new StringTokenizer(br.readLine().trim());
		return st.nextToken();
	}
	static long readLong () throws IOException {
		return Long.parseLong(next());
	}
	static int readInt () throws IOException {
		return Integer.parseInt(next());
	}
	static double readDouble () throws IOException {
		return Double.parseDouble(next());
	}
	static char readCharacter () throws IOException {
		return next().charAt(0);
	}
	static String readLine () throws IOException {
		return br.readLine().trim();
	}
}


import java.util.*;
import java.io.*;
public class C1084 {
	static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	static PrintWriter pr = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
	static StringTokenizer st;
	static long mod = 998244353;
	public static void main(String[]args)throws IOException {
		String s = next();
		ArrayList<Integer>list = new ArrayList<Integer>();
		int count = 0;
		for(int i = 0; i<s.length(); i++) {
			if(s.charAt(i)=='a') {
				count++;
			}
			if(s.charAt(i)=='b') {
				if(count>0)
				list.add(count);
				count = 0;
			}
		}
		if(count>0) list.add(count);
		long[]array= new long[list.size()+1];
		for(int i = 0; i<list.size(); i++) {
			array[i+1] = list.get(i);
		}
		array[0] = 1;
		long ans = 0;
		for(int i = 1; i<=list.size(); i++) {
			long prod = 1;
			for(int j = i; j<=list.size(); j++) {
				prod*=array[j];
				prod%=mod;
				ans+=prod;
				ans%=mod;
			}
		}
		pr.println(ans);
		pr.close();
	}
	static String next () throws IOException {
		while (st == null || !st.hasMoreTokens())
			st = new StringTokenizer(br.readLine().trim());
		return st.nextToken();
	}
	static long readLong () throws IOException {
		return Long.parseLong(next());
	}
	static int readInt () throws IOException {
		return Integer.parseInt(next());
	}
	static double readDouble () throws IOException {
		return Double.parseDouble(next());
	}
	static char readCharacter () throws IOException {
		return next().charAt(0);
	}
	static String readLine () throws IOException {
		return br.readLine().trim();
	}
}


/*
 * Date Created : 6/10/2020
 * Have A Good Day !
 */

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.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

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

    static class CTheFairNutAndString {
        long mod = (long) 1e9 + 7;

        long mul(long a, long b) {
            return (a * b) % mod;
        }

        long add(long a, long b) {
            return (a + b) % mod;
        }

        public void solve(int testNumber, FastReader r, OutputWriter out) {
            char[] str = r.next().toCharArray();
            int n = str.length;
            long ans = 0;
            for (int i = 0; i < n; i++) if (str[i] == 'a') ans++;
            boolean flag = false;
            long cnt1 = 0, cnt2 = 0;
            for (int i = 0; i < n; i++) {
                if (str[i] == 'a') {
                    if (!flag) {
                        cnt1 = 1;
                        while (i + 1 < n && str[i + 1] == 'a') {
                            i++;
                            cnt1++;
                        }
                    } else {
                        cnt2 = 1;
                        while (i + 1 < n && str[i + 1] == 'a') {
                            i++;
                            cnt2++;
                        }
                        flag = false;
                        ans = add(ans, mul(cnt1, cnt2));
                        cnt1 = cnt2;
                        cnt2 = 0;
                    }
                } else if (str[i] == 'b') {
                    flag = true;
                }
            }
            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 print(Object... objects) {
            for (int i = 0; i < objects.length; i++) {
                writer.print(objects[i]);
                if (i != objects.length - 1) writer.print(" ");
            }
        }

        public void println(Object... objects) {
            print(objects);
            writer.println();
        }

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

    }

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

        public FastReader(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 String next() {
            return nextString();
        }

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

        }

    }
}


/*
 * Date Created : 6/10/2020
 * Have A Good Day !
 */

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.ArrayList;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.InputStream;

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

    static class CTheFairNutAndString {
        long mod = (long) 1e9 + 7;

        long mul(long a, long b) {
            return (a * b) % mod;
        }

        public void solve(int testNumber, FastReader r, OutputWriter out) {
            char[] str = r.next().toCharArray();
            int n = str.length;
            ArrayList<Integer> sizes = new ArrayList<>();
            for (int i = 0; i < n; i++) {
                if (str[i] == 'a') {
                    int cnt = 1;
                    while (i + 1 < n && str[i + 1] != 'b') {
                        if (str[i] == 'a') cnt++;
                        i++;
                    }
                    sizes.add(cnt + 1);
                }
            }
            long ans = 1;
            for (int i = 0; i < sizes.size(); i++) ans = mul(ans, sizes.get(i));
            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 print(Object... objects) {
            for (int i = 0; i < objects.length; i++) {
                writer.print(objects[i]);
                if (i != objects.length - 1) writer.print(" ");
            }
        }

        public void println(Object... objects) {
            print(objects);
            writer.println();
        }

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

    }

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

        public FastReader(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 String next() {
            return nextString();
        }

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

        }

    }
}


/*
 * Date Created : 6/10/2020
 * Have A Good Day !
 */

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.ArrayList;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.InputStream;

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

    static class CTheFairNutAndString {
        long mod = (long) 1e9 + 7;

        long mul(long a, long b) {
            return (a * b) % mod;
        }

        public void solve(int testNumber, FastReader r, OutputWriter out) {
            char[] str = r.next().toCharArray();
            int n = str.length;
            ArrayList<Integer> sizes = new ArrayList<>();
            for (int i = 0; i < n; i++) {
                if (str[i] == 'a') {
                    int cnt = 1;
                    while (i + 1 < n && str[i + 1] != 'b') {
                        if (str[i + 1] == 'a') cnt++;
                        i++;
                    }
                    sizes.add(cnt + 1);
                }
            }
            long ans = 1;
            for (int i = 0; i < sizes.size(); i++) ans = mul(ans, sizes.get(i));
            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 print(Object... objects) {
            for (int i = 0; i < objects.length; i++) {
                writer.print(objects[i]);
                if (i != objects.length - 1) writer.print(" ");
            }
        }

        public void println(Object... objects) {
            print(objects);
            writer.println();
        }

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

    }

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

        public FastReader(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 String next() {
            return nextString();
        }

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

        }

    }
}


/*
 * Date Created : 6/10/2020
 * Have A Good Day !
 */

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.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

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

    static class CTheFairNutAndString {
        long mod = (long) 1e9 + 7;

        long mul(long a, long b) {
            return (a * b) % mod;
        }

        long add(long a, long b) {
            return (a + b) % mod;
        }

        public void solve(int testNumber, FastReader r, OutputWriter out) {
            char[] str = r.next().toCharArray();
            int n = str.length;
            long[] suffix = new long[n];
            for (int i = n - 1; i >= 0; i--) {
                suffix[i] = i + 1 < n ? suffix[i + 1] : 0;
                if (str[i] == 'a') suffix[i]++;
            }
//        out.debugln("suffix", suffix);
            long ans = suffix[0];
            for (int i = 0; i < n; i++) {
                if (str[i] == 'b') {
                    long cnt1 = suffix[0] - suffix[i];
                    long cnt2 = suffix[i];
                    ans = add(ans, mul(cnt1, cnt2));
                    while (i + 1 < n && str[i + 1] == 'b') i++;
                }
            }
            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 print(Object... objects) {
            for (int i = 0; i < objects.length; i++) {
                writer.print(objects[i]);
                if (i != objects.length - 1) writer.print(" ");
            }
        }

        public void println(Object... objects) {
            print(objects);
            writer.println();
        }

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

    }

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

        public FastReader(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 String next() {
            return nextString();
        }

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

        }

    }
}


import java.util.*;
import java.io.*;
import java.math.*;
public class Main
{
    static class Reader
    {
        private InputStream mIs;private byte[] buf = new byte[1024];private int curChar,numChars;public Reader() { this(System.in); }public Reader(InputStream is) { mIs = is;}
        public int read() {if (numChars == -1) throw new InputMismatchException();if (curChar >= numChars) {curChar = 0;try { numChars = mIs.read(buf);} catch (IOException e) { throw new InputMismatchException();}if (numChars <= 0) return -1; }return buf[curChar++];}
        public String nextLine(){int c = read();while (isSpaceChar(c)) c = read();StringBuilder res = new StringBuilder();do {res.appendCodePoint(c);c = read();}while (!isEndOfLine(c));return res.toString() ;}
        public String s(){int c = read();while (isSpaceChar(c)) c = read();StringBuilder res = new StringBuilder();do {res.appendCodePoint(c);c = read();}while (!isSpaceChar(c));return res.toString();}
        public long l(){int c = read();while (isSpaceChar(c)) c = read();int sgn = 1;if (c == '-') { sgn = -1 ; c = read() ; }long res = 0; do{ if (c < '0' || c > '9') throw new InputMismatchException();res *= 10 ; res += c - '0' ; c = read();}while(!isSpaceChar(c));return res * sgn;}
        public int i(){int c = read() ;while (isSpaceChar(c)) c = read();int sgn = 1;if (c == '-') { sgn = -1 ; c = read() ; }int res = 0;do{if (c < '0' || c > '9') throw new InputMismatchException();res *= 10 ; res += c - '0' ; c = read() ;}while(!isSpaceChar(c));return res * sgn;}
        public double d() throws IOException {return Double.parseDouble(s()) ;}
        public boolean isSpaceChar(int c) { return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1; }
        public boolean isEndOfLine(int c) { return c == '\n' || c == '\r' || c == -1; }
        public int[] arr(int n){int[] ret = new int[n];for (int i = 0; i < n; i++) {ret[i] = i();}return ret;}
    }

           //       |----|       /\      |    |   -----   |
           //       |   /       /  \     |    |     |     |
           //       |--/       /----\    |----|     |     |
           //       |   \     /      \   |    |     |     |
           //       |    \   /        \  |    |   -----   -------

    public static void main(String[] args)throws IOException
    {
        PrintWriter out= new PrintWriter(System.out);
        Reader sc=new Reader();
        String s=sc.s();
        int n=s.length();
        long count=0;
        ArrayList<Long> al=new ArrayList<>();
        for(int i=0;i<n;i++)
        {
            if(s.charAt(i)=='b')
            {
                if(count!=0)
                al.add(count);
                count=0;
            }
            if(s.charAt(i)=='a')
            count++;
        }
        if(count!=0)
        al.add(count);

        int m=al.size();
        long ans=1;
        for(int j=0;j<m;j++)
        {
            ans*=(al.get(j)+1);
            ans%=1000000007;
        }
        out.println(ans-1);
        out.flush();
    }
}


import java.util.*;
import java.io.*;
import java.math.*;
public class Main
{
    static class Reader
    {
        private InputStream mIs;private byte[] buf = new byte[1024];private int curChar,numChars;public Reader() { this(System.in); }public Reader(InputStream is) { mIs = is;}
        public int read() {if (numChars == -1) throw new InputMismatchException();if (curChar >= numChars) {curChar = 0;try { numChars = mIs.read(buf);} catch (IOException e) { throw new InputMismatchException();}if (numChars <= 0) return -1; }return buf[curChar++];}
        public String nextLine(){int c = read();while (isSpaceChar(c)) c = read();StringBuilder res = new StringBuilder();do {res.appendCodePoint(c);c = read();}while (!isEndOfLine(c));return res.toString() ;}
        public String s(){int c = read();while (isSpaceChar(c)) c = read();StringBuilder res = new StringBuilder();do {res.appendCodePoint(c);c = read();}while (!isSpaceChar(c));return res.toString();}
        public long l(){int c = read();while (isSpaceChar(c)) c = read();int sgn = 1;if (c == '-') { sgn = -1 ; c = read() ; }long res = 0; do{ if (c < '0' || c > '9') throw new InputMismatchException();res *= 10 ; res += c - '0' ; c = read();}while(!isSpaceChar(c));return res * sgn;}
        public int i(){int c = read() ;while (isSpaceChar(c)) c = read();int sgn = 1;if (c == '-') { sgn = -1 ; c = read() ; }int res = 0;do{if (c < '0' || c > '9') throw new InputMismatchException();res *= 10 ; res += c - '0' ; c = read() ;}while(!isSpaceChar(c));return res * sgn;}
        public double d() throws IOException {return Double.parseDouble(s()) ;}
        public boolean isSpaceChar(int c) { return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1; }
        public boolean isEndOfLine(int c) { return c == '\n' || c == '\r' || c == -1; }
        public int[] arr(int n){int[] ret = new int[n];for (int i = 0; i < n; i++) {ret[i] = i();}return ret;}
    }

           //       |----|       /\      |    |   -----   |
           //       |   /       /  \     |    |     |     |
           //       |--/       /----\    |----|     |     |
           //       |   \     /      \   |    |     |     |
           //       |    \   /        \  |    |   -----   -------

    public static void main(String[] args)throws IOException
    {
        PrintWriter out= new PrintWriter(System.out);
        Reader sc=new Reader();
        String s=sc.s();
        int n=s.length();
        long count=0;
        ArrayList<Long> al=new ArrayList<>();
        for(int i=0;i<n;i++)
        {
            if(s.charAt(i)=='b')
            {
                if(count!=0)
                al.add(count);
                count=0;
            }
            if(s.charAt(i)=='a')
            count++;
        }
        if(count!=0)
        al.add(count);

        int m=al.size();
        long ans=1;
        for(int j=0;j<m;j++)
        {
            ans*=(al.get(j)+1);
            ans%=1000000000;
        }
        out.println(ans-1);
        out.flush();
    }
}


import java.util.*;
import java.io.*;
import java.math.*;
public class Main
{
    static class Reader
    {
        private InputStream mIs;private byte[] buf = new byte[1024];private int curChar,numChars;public Reader() { this(System.in); }public Reader(InputStream is) { mIs = is;}
        public int read() {if (numChars == -1) throw new InputMismatchException();if (curChar >= numChars) {curChar = 0;try { numChars = mIs.read(buf);} catch (IOException e) { throw new InputMismatchException();}if (numChars <= 0) return -1; }return buf[curChar++];}
        public String nextLine(){int c = read();while (isSpaceChar(c)) c = read();StringBuilder res = new StringBuilder();do {res.appendCodePoint(c);c = read();}while (!isEndOfLine(c));return res.toString() ;}
        public String s(){int c = read();while (isSpaceChar(c)) c = read();StringBuilder res = new StringBuilder();do {res.appendCodePoint(c);c = read();}while (!isSpaceChar(c));return res.toString();}
        public long l(){int c = read();while (isSpaceChar(c)) c = read();int sgn = 1;if (c == '-') { sgn = -1 ; c = read() ; }long res = 0; do{ if (c < '0' || c > '9') throw new InputMismatchException();res *= 10 ; res += c - '0' ; c = read();}while(!isSpaceChar(c));return res * sgn;}
        public int i(){int c = read() ;while (isSpaceChar(c)) c = read();int sgn = 1;if (c == '-') { sgn = -1 ; c = read() ; }int res = 0;do{if (c < '0' || c > '9') throw new InputMismatchException();res *= 10 ; res += c - '0' ; c = read() ;}while(!isSpaceChar(c));return res * sgn;}
        public double d() throws IOException {return Double.parseDouble(s()) ;}
        public boolean isSpaceChar(int c) { return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1; }
        public boolean isEndOfLine(int c) { return c == '\n' || c == '\r' || c == -1; }
        public int[] arr(int n){int[] ret = new int[n];for (int i = 0; i < n; i++) {ret[i] = i();}return ret;}
    }

           //       |----|       /\      |    |   -----   |
           //       |   /       /  \     |    |     |     |
           //       |--/       /----\    |----|     |     |
           //       |   \     /      \   |    |     |     |
           //       |    \   /        \  |    |   -----   -------

    public static void main(String[] args)throws IOException
    {
        PrintWriter out= new PrintWriter(System.out);
        Reader sc=new Reader();
        String s=sc.s();
        int n=s.length();
        long ans=0;
        for(int i=0;i<n;i++)if(s.charAt(i)=='a')ans++;
        long count=0;
        int flag=0;
        ArrayList<Long> al=new ArrayList<>();
        for(int i=0;i<n;i++)
        {
            if(s.charAt(i)=='b')
            {
                if(count!=0)
                al.add(count);
                count=0;
            }
            if(s.charAt(i)=='a')
            count++;
        }
        if(count!=0)
        al.add(count);
        int m=al.size();
        long counter=0;
        for(int j=0;j<m;j++)
        {
            ans+=(counter*(counter+1))/2*al.get(j);
            ans%=1000000000;
            counter++;
        }
        out.println(ans);
        out.flush();
    }
}


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

public class Main {
    static  long MOD = 1000000007;
    public static void main(String[] args) throws Exception {
        MyScanner in = new MyScanner(System.in);
        OutputWriter out = new OutputWriter(System.out);
        char[]a = in.next().toCharArray();
        long cntr =0;
        int n = a.length;
        for (int i =0;i<n-1;i++) {
            if (a[i] == a[i + 1] && a[i] == 'b') {
                a[i + 1] = 'c';
            }
            if (a[i]=='a')
                cntr++;
        }
        if (a[n-1]=='a')
            cntr++;
        long cur=0;
        long ans=0;
        for (int i =0;i<n;i++)
        {
            if (a[i]=='a')
                cur++;
            else if (a[i]=='b')
            {
                long rem = cntr-cur;
                ans+=(rem*cur)%MOD;
                ans%=MOD;
            }
        }
        out.printLine((cntr+ans)%MOD);

        out.flush();
    }

}
class MyScanner {

    StringTokenizer st;
    BufferedReader br;

    public MyScanner(InputStream s) {
        br = new BufferedReader(new InputStreamReader(s));
    }

    public MyScanner (FileReader f) {
        br = new BufferedReader(f);
    }

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

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

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

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

    public double nextDouble() throws IOException {
        String x = next();
        StringBuilder sb = new StringBuilder("0");
        double res = 0, f = 1;
        boolean dec = false, neg = false;
        int start = 0;
        if (x.charAt(0) == '-') {
            neg = true;
            start++;
        }
        for (int i = start; i < x.length(); i++)
            if (x.charAt(i) == '.') {
                res = Long.parseLong(sb.toString());
                sb = new StringBuilder("0");
                dec = true;
            } else {
                sb.append(x.charAt(i));
                if (dec)
                    f *= 10;
            }
        res += Long.parseLong(sb.toString()) / f;
        return res * (neg ? -1 : 1);
    }

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

    public boolean nextEmpty() throws IOException {
        String s = nextLine();
        st = new StringTokenizer(s);
        return s.isEmpty();
    }
}

class pair  implements Comparable
{
    int key;
    int value;
    public pair(Object key, Object value) {

        this.key = (int)key;
        this.value=(int)value;
    }
    @Override
    public int compareTo(Object o) {
        pair temp =(pair)o;
        return  key-temp.key;
    }
}
class Graph {

    int n;
    ArrayList<Integer>[] adjList;

    public Graph(int n) {
        this.n = n;
        adjList = new ArrayList[n];
        for (int i = 0; i < n; i++)
            adjList[i] = new ArrayList<>();
    }

}

class InputReader {

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

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

    public int read() {
        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 = read();
        while (isSpaceChar(c)) {
            c = read();
        }
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        int res = 0;
        do {
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isSpaceChar(c));
        return res * sgn;
    }

    public long nextLong() {
        int c = read();
        while (isSpaceChar(c)) {
            c = read();
        }
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        long res = 0;
        do {
            res *= 10;
            res += c - '0';
            c = read();
        } 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 String readString() {
        int c = read();
        while (isSpaceChar(c)) {
            c = read();
        }
        StringBuilder res = new StringBuilder();
        do {
            res.appendCodePoint(c);
            c = read();
        } while (!isSpaceChar(c));
        return res.toString();
    }

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

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

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

}

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 print(Object... objects) {
        for (int i = 0; i < objects.length; i++) {
            if (i != 0)
                writer.print(' ');
            writer.print(objects[i]);
        }
    }

    public void printLine(Object... objects) {
        print(objects);
        writer.println();
    }

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

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

}


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

public class Main {
    static  long MOD = 1000000007;
    public static void main(String[] args) throws Exception {
        MyScanner in = new MyScanner(System.in);
        OutputWriter out = new OutputWriter(System.out);
        char[]a = in.next().toCharArray();
        int n = a.length;
        long ans=1;
        long curr =1;
        for(int i =0;i<n;i++)
        {
           if (a[i]=='a')
           {
               curr++;
           }
           else if (a[i]=='b')
           {
               ans*=curr%MOD;
               ans%=MOD;
               curr=1;
           }
        }
        ans*=curr;
        ans--;
        out.printLine(ans%MOD);

        out.flush();
    }

}
class MyScanner {

    StringTokenizer st;
    BufferedReader br;

    public MyScanner(InputStream s) {
        br = new BufferedReader(new InputStreamReader(s));
    }

    public MyScanner (FileReader f) {
        br = new BufferedReader(f);
    }

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

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

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

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

    public double nextDouble() throws IOException {
        String x = next();
        StringBuilder sb = new StringBuilder("0");
        double res = 0, f = 1;
        boolean dec = false, neg = false;
        int start = 0;
        if (x.charAt(0) == '-') {
            neg = true;
            start++;
        }
        for (int i = start; i < x.length(); i++)
            if (x.charAt(i) == '.') {
                res = Long.parseLong(sb.toString());
                sb = new StringBuilder("0");
                dec = true;
            } else {
                sb.append(x.charAt(i));
                if (dec)
                    f *= 10;
            }
        res += Long.parseLong(sb.toString()) / f;
        return res * (neg ? -1 : 1);
    }

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

    public boolean nextEmpty() throws IOException {
        String s = nextLine();
        st = new StringTokenizer(s);
        return s.isEmpty();
    }
}

class pair  implements Comparable
{
    int key;
    int value;
    public pair(Object key, Object value) {

        this.key = (int)key;
        this.value=(int)value;
    }
    @Override
    public int compareTo(Object o) {
        pair temp =(pair)o;
        return  key-temp.key;
    }
}
class Graph {

    int n;
    ArrayList<Integer>[] adjList;

    public Graph(int n) {
        this.n = n;
        adjList = new ArrayList[n];
        for (int i = 0; i < n; i++)
            adjList[i] = new ArrayList<>();
    }

}

class InputReader {

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

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

    public int read() {
        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 = read();
        while (isSpaceChar(c)) {
            c = read();
        }
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        int res = 0;
        do {
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isSpaceChar(c));
        return res * sgn;
    }

    public long nextLong() {
        int c = read();
        while (isSpaceChar(c)) {
            c = read();
        }
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        long res = 0;
        do {
            res *= 10;
            res += c - '0';
            c = read();
        } 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 String readString() {
        int c = read();
        while (isSpaceChar(c)) {
            c = read();
        }
        StringBuilder res = new StringBuilder();
        do {
            res.appendCodePoint(c);
            c = read();
        } while (!isSpaceChar(c));
        return res.toString();
    }

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

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

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

}

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 print(Object... objects) {
        for (int i = 0; i < objects.length; i++) {
            if (i != 0)
                writer.print(' ');
            writer.print(objects[i]);
        }
    }

    public void printLine(Object... objects) {
        print(objects);
        writer.println();
    }

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

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

}


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

public class Main {
    static  long MOD = 1000000007;
    public static void main(String[] args) throws Exception {
        MyScanner in = new MyScanner(System.in);
        OutputWriter out = new OutputWriter(System.out);
        char[]a = in.next().toCharArray();
        long cntr =0;
        int n = a.length;
        boolean tr = false;
        long temp=0;
        long ans=0;
        for (int i =0;i<n;i++)
        {
            if (a[i]=='a')
            {
                if (tr) {
                    long u = cntr - temp;
                    ans += (u) % MOD;
                    ans %= MOD;
                }
                cntr++;
                temp++;
            }
            else if (a[i]=='b')
            {
                temp=0;
                tr = true;
            }

        }
        out.printLine((cntr+ans)%MOD);

        out.flush();
    }

}
class MyScanner {

    StringTokenizer st;
    BufferedReader br;

    public MyScanner(InputStream s) {
        br = new BufferedReader(new InputStreamReader(s));
    }

    public MyScanner (FileReader f) {
        br = new BufferedReader(f);
    }

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

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

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

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

    public double nextDouble() throws IOException {
        String x = next();
        StringBuilder sb = new StringBuilder("0");
        double res = 0, f = 1;
        boolean dec = false, neg = false;
        int start = 0;
        if (x.charAt(0) == '-') {
            neg = true;
            start++;
        }
        for (int i = start; i < x.length(); i++)
            if (x.charAt(i) == '.') {
                res = Long.parseLong(sb.toString());
                sb = new StringBuilder("0");
                dec = true;
            } else {
                sb.append(x.charAt(i));
                if (dec)
                    f *= 10;
            }
        res += Long.parseLong(sb.toString()) / f;
        return res * (neg ? -1 : 1);
    }

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

    public boolean nextEmpty() throws IOException {
        String s = nextLine();
        st = new StringTokenizer(s);
        return s.isEmpty();
    }
}

class pair  implements Comparable
{
    int key;
    int value;
    public pair(Object key, Object value) {

        this.key = (int)key;
        this.value=(int)value;
    }
    @Override
    public int compareTo(Object o) {
        pair temp =(pair)o;
        return  key-temp.key;
    }
}
class Graph {

    int n;
    ArrayList<Integer>[] adjList;

    public Graph(int n) {
        this.n = n;
        adjList = new ArrayList[n];
        for (int i = 0; i < n; i++)
            adjList[i] = new ArrayList<>();
    }

}

class InputReader {

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

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

    public int read() {
        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 = read();
        while (isSpaceChar(c)) {
            c = read();
        }
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        int res = 0;
        do {
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isSpaceChar(c));
        return res * sgn;
    }

    public long nextLong() {
        int c = read();
        while (isSpaceChar(c)) {
            c = read();
        }
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        long res = 0;
        do {
            res *= 10;
            res += c - '0';
            c = read();
        } 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 String readString() {
        int c = read();
        while (isSpaceChar(c)) {
            c = read();
        }
        StringBuilder res = new StringBuilder();
        do {
            res.appendCodePoint(c);
            c = read();
        } while (!isSpaceChar(c));
        return res.toString();
    }

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

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

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

}

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 print(Object... objects) {
        for (int i = 0; i < objects.length; i++) {
            if (i != 0)
                writer.print(' ');
            writer.print(objects[i]);
        }
    }

    public void printLine(Object... objects) {
        print(objects);
        writer.println();
    }

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

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

}


import java.io.*;
import java.util.*;
public class C1084
{
    public static void main(String args[])throws IOException
    {
        Scanner sc=new Scanner(System.in);
        String s=sc.next();
        List<Integer> list=new ArrayList<>();
        List<Integer> cou=new ArrayList<>();
        char prev=s.charAt(0);int c=1;
        for(int i=1;i<s.length();i++)
        {
           if(s.charAt(i)==prev)
               c++;
           else
           {
               if(s.charAt(i)=='a' || s.charAt(i)=='b')
               {
                   if(prev=='a')
                   {
                       list.add(0);
                       cou.add(c);
                   }
                   if(prev=='b')
                   {
                       list.add(1);
                       cou.add(1);
                   }
                   prev=s.charAt(i);
                   c=1;
               }

           }
        }
        if(prev=='a')
        {
            list.add(0);
            cou.add(c);
        }
        //System.out.println(list+" "+cou);
        List<Long> ans=new ArrayList<>();
        ans.add(0L);c=0;
        for(int i=0;i<list.size();i++)
        {
            if(list.get(i)==0)
            {
                c++;long val=cou.get(i);
                List<Long> temp=new ArrayList<>();
                for(int j=1;j<=c;j++)
                {
                    if(j==1)
                        temp.add(ans.get(0)+val);
                    else
                    {
                        //System.out.println(ans.get(j-1)+" "+val);
                        temp.add(((ans.get(j-2)*val) + ans.get(j-1))%1000000007);
                    }
                }
                ans=temp;
                ans.add(0L);
                //System.out.println(ans+" "+val);
            }
        }
        long sum=0;
        for(long i:ans)
        {
            sum+=i;
        }
        System.out.println(sum%1000000007);
    }
}


import java.io.*;
import java.util.*;
public class C1084
{
    public static void main(String args[])throws IOException
    {
        Scanner sc=new Scanner(System.in);
        String s=sc.next();
        List<Integer> list=new ArrayList<>();
        List<Integer> cou=new ArrayList<>();
        char prev=s.charAt(0);int c=1;
        for(int i=1;i<s.length();i++)
        {
           if(s.charAt(i)==prev)
               c++;
           else
           {
               if(s.charAt(i)=='a' || s.charAt(i)=='b')
               {
                   if(prev=='a')
                   {
                       list.add(0);
                       cou.add(c);
                   }
                   if(prev=='b')
                   {
                       list.add(1);
                       cou.add(1);
                   }
                   prev=s.charAt(i);
                   c=1;
               }

           }
        }
        if(prev=='a')
        {
            list.add(0);
            cou.add(c);
        }
        List<Long> ans=new ArrayList<>();
        ans.add(0L);c=0;
        for(int i=0;i<list.size();i++)
        {
            if(list.get(i)==0)
            {
                c++;long val=cou.get(i);
                List<Long> temp=new ArrayList<>();
                for(int j=1;j<=c;j++)
                {
                    if(j==1)
                        temp.add(ans.get(0)+val);
                    else
                    {
                        //System.out.println(ans.get(j-1)+" "+val);
                        temp.add((ans.get(j-2)*val)%1000000007);
                    }
                }
                ans=temp;
                ans.add(0L);
                //System.out.println(ans+" "+val);
            }
        }
        long sum=0;
        for(long i:ans)
        {
            sum+=i;
        }
        System.out.println(sum%1000000007);
    }
}


import java.io.*;
import java.util.*;
public class C1084
{
    public static void main(String args[])throws IOException
    {
        Scanner sc=new Scanner(System.in);
        String s=sc.next();
        List<Integer> list=new ArrayList<>();
        List<Integer> cou=new ArrayList<>();
        char prev=s.charAt(0);int c=1;
        long sum=1;
        for(int i=1;i<s.length();i++)
        {
           if(s.charAt(i)==prev)
               c++;
           else
           {
               if(s.charAt(i)=='a' || s.charAt(i)=='b')
               {
                   if(prev=='a')
                   {
                       list.add(0);
                       cou.add(c);
                       sum=sum*(c+1);
                       sum%=1000000007;
                   }
                   if(prev=='b')
                   {
                       //System.out.println(c);
                       //sum=(sum*(c+1))%1000000007;
                       list.add(1);
                       cou.add(1);
                   }
                   prev=s.charAt(i);
                   c=1;
               }

           }
        }
        //System.out.println(sum);
        if(prev=='a')
        {
            sum=(sum*(c+1))%1000000007;
            list.add(0);
            cou.add(c);
        }
        System.out.println((sum-1+1000000007)%1000000007);
    }
}


import java.io.*;
import java.util.*;
public class C1084
{
    public static void main(String args[])throws IOException
    {
        Scanner sc=new Scanner(System.in);
        String s=sc.next();
        List<Integer> list=new ArrayList<>();
        List<Integer> cou=new ArrayList<>();
        char prev=s.charAt(0);int c=1;
        for(int i=1;i<s.length();i++)
        {
           if(s.charAt(i)==prev)
               c++;
           else
           {
               if(s.charAt(i)=='a' || s.charAt(i)=='b')
               {
                   if(prev=='a')
                   {
                       list.add(0);
                       cou.add(c);
                   }
                   if(prev=='b')
                   {
                       list.add(1);
                       cou.add(1);
                   }
                   prev=s.charAt(i);
                   c=1;
               }

           }
        }
        if(prev=='a')
        {
            list.add(0);
            cou.add(c);
        }
        //System.out.println(list+" "+cou);
        long ans[]=new long[s.length()+1];
        c=0;
        for(int i=0;i<list.size();i++)
        {
            if(list.get(i)==0)
            {
                c++;long val=cou.get(i);long pre=0;
                for(int j=1;j<=c;j++)
                {
                    if(j==1)
                    {
                        pre=ans[j];
                        ans[j]+=val;
                    }
                    else
                    {
                        //System.out.println(ans.get(j-1)+" "+val);
                        long tt=pre*val+ans[j];
                        tt%=1000000007;
                        pre=ans[j];
                        ans[j]=tt;
                    }
                }

                //System.out.println(ans+" "+val);
            }
        }
        long sum=0;
        for(long i:ans)
        {
            sum+=i;
        }
        System.out.println(sum%1000000007);
    }
}


import java.util.*;
public class Abc {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		String s = in.next();
		int n = s.length();
		ArrayList<Integer> ar = new ArrayList<>();
		int count = 0;
		for(int i = 0; i < n; i ++) {
			char c = s.charAt(i);
			if(c == 'a') {
				count++;
			} else if (c == 'b') {
				if(count > 0) {
					ar.add(count);
				}
				count = 0;
			}
		}
		if(count > 0) {
			ar.add(count);
		}
		long sum = 1;
		long mod = 1000000007;
		for(int i = 0; i < ar.size(); i++) {
			sum *= (ar.get(i) + 1) % mod;
			sum %= mod;
		}
		System.out.println((sum - 1 + mod) % mod);
	}
	public static long pow(long a, long b, long mod) {
		long result = 1;
		while(b > 0) {
			if(result % 2 == 1) {
				result = (result * a) % mod;
			}
			a = (a * a) % mod;
			b /= 2;
		}
		return result;
	}
}


import java.util.*;
public class Abc {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int m = in.nextInt();
		int k = in.nextInt();

		long fact[] = new long[2001];
		long mod = 998244353;

		fact[0] = 1;
		for(int i = 1; i < n ; i++) {
			fact [i] = (i * fact[i - 1]) % mod;
		}

		long c = comb(n - 1, k, fact, mod);
		c = (c * m) % mod;
		if(k > 1) {
			c = (c * pow(m - 1, k, mod)) % mod;
		}
		if(m == 1 && k > 0) {
			System.out.println(0);
		} else {
			System.out.println(c);
		}
	}
	static long comb(int a, int b, long fact[], long c) {
		if(b == 0) {
			return 1;
		}
		long num = fact[a];
		long denom = (fact[b] * fact[a - b]) % c;
		return (num * modInverse(denom, c)) % c;
	}
	static long modInverse(long a, long b) {
		return pow(a, b - 2, b);
	}
	static long pow(long a, long b, long mod) {
		long result = 1;
		while(b > 0) {
			if(b % 2 == 1) {
				result = (result * a) % mod;
			}
			a = (a * a) % mod;
			b /= 2;
		}
		return result;
	}
}


import java.util.*;
public class Abc {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		String s = in.next();
		int n = s.length();
		ArrayList<Integer> ar = new ArrayList<>();
		int count = 0;
		for(int i = 0; i < n; i ++) {
			char c = s.charAt(i);
			if(c == 'a') {
				count++;
			} else if (c == 'b') {
				if(count > 0) {
					ar.add(count);
				}
				count = 0;
			}
		}
		if(count > 0) {
			ar.add(count);
		}
		long res = 0;
		long sum = 0;
		long mod = 1000000007;
		for(int i = 0; i < ar.size(); i++) {
			sum += ar.get(i);
			if(res == 0) {
				res = ar.get(i);
			} else {
				res *= ar.get(i);
				res %= mod;
			}
		}
		if(ar.size() > 1) {
			res += sum;
			res %= mod;
		}
		System.out.println(res);
	}
}