15
txxtxttxxttxtxx
 3
myw
 127
xixtxixnxixtxixlxixtxixnxixtxixoxixtxixnxixtxixlxixtxixnxixtxixhxixtxixnxixtxixlxixtxixnxixtxixoxixtxixnxixtxixlxixtxixnxixtxix
 1
a
 10
isssisssss
 2
ff
 1
z

27824
 10
 944124121
 1
 176
 1
 1

#include <bits/stdc++.h>
using namespace std;
long long dp[5010][26];
long long total[5010];
long long comb[5010];
long long inverseModp(long long a, long long p) {
  long long ex = p - 2, result = 1;
  while (ex > 0) {
    if (ex % 2 == 1) {
      result = (result * a) % p;
    }
    a = (a * a) % p;
    ex /= 2;
  }
  return result;
}
void nCrModp(long long n, long long p) {
  comb[0] = 1;
  long long r = 0;
  long long result = 1;
  for (long long i = n, x = 1; i > r; --i, ++x) {
    result = (result * i) % p;
    comb[x] = result;
  }
  result = 1;
  for (long long i = n, x = 1; i > r; --i, ++x) {
    result = (result * inverseModp(x, p)) % p;
    comb[x] = (comb[x] * result) % p;
  }
}
int32_t main() {
  long long n, N;
  cin >> n;
  N = n;
  string tmp, s = "";
  cin >> tmp;
  s += tmp[0];
  for (long long i = 1; i < tmp.size(); i++)
    if (tmp[i] != tmp[i - 1]) s += tmp[i];
  n = s.size();
  for (long long i = 0; i <= n; i++) {
    for (long long j = 0; j < 26; j++) dp[i][j] = 0;
    total[i] = 0;
  }
  nCrModp(N - 1, 1000000007);
  for (long long i = 0; i < n; i++) {
    long long c = s[i] - 'a';
    total[0] -= dp[0][c];
    dp[0][c] = 1;
    total[0] += dp[0][c];
    for (long long j = 1; j < n && total[j - 1]; j++) {
      total[j] -= dp[j][c];
      if (total[j] < 0) total[j] += 1000000007;
      dp[j][c] = total[j - 1] - dp[j - 1][c];
      if (dp[j][c] < 0) dp[j][c] += 1000000007;
      total[j] = (total[j] + dp[j][c]) % 1000000007;
    }
  }
  long long res = 0;
  for (long long i = 0; i < n; i++)
    res = (res + (total[i] * comb[i]) % 1000000007) % 1000000007;
  cout << res << endl;
  return 0;
}
