#include <iostream>
#define forn(i, n) for (int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
const ll mod = 1e9+7;
const int oo = 1e6+7;
ll getdp(int ind, int l);
ll dp[oo][26];
int s[oo];
int n;
string ss;
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin >> n >> ss;
	forn(i, n) s[i]=ss[i]-'A';
	forn(i, n) forn(j, 26) dp[i][j]=-1;
	int sum = 0;
	for (int i = n-1; i>=0; i--) {
		if (s[i]==25) sum++;
		dp[i][25]=sum;
	}
	forn(i, 26) dp[n][i] = 0;
	cout << getdp(0, 0) << endl;
}
ll getdp(int x, int l) {
	if (dp[x][l]!=-1) return dp[x][l];
	if (s[x]!=l) dp[x][l] = getdp(x+1, l);
	else dp[x][l] = getdp(x+1,l)+getdp(x+1, l+1);
	dp[x][l] %= mod;
	return dp[x][l];
}