#include<iostream>
#include<vector>
#include<algorithm>
#include<limits>
#include<string>
#include<map>

using namespace std;

int main()
{
	long n;
	string s;
	long c = 1;
	long long int ispis = 1;

	cin >> n >> s;

	for (int i = 0;i < n;i++) {

		if (s[i] == s[i + 1]) {
			c++;
		}
		else {
			ispis *= c;
			c = 1;
		}
	}

	long long int resenje = ispis % 1000000007;

	cout << resenje;



}