#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<a.size())
    {

        if(a[i]==a[i+1]) {br++;}
        else
        {
            brrr++;
            if(brrr!=26) br++;
            if(br!=0) p*=br;
            br=0;
        }
        i++;
    }
    cout<<p%(10000000000+7);


}