#include <iostream>
#include <string.h>
using namespace std;


main ()
{
    string a;
    int n;
    long long int br=0,i=0,p=1,brrr=0;
    cin>>n;
    cin>>a;
    while(i<n)
    {
        if(a[i]==a[i+1]) {br++;}
        else
        {
            br++;
            if(br!=0) p*=br;
            br=0;
        }
        i++;
    }
    cout<<p%(1000000007);


}