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>
const double eps = 0.000000001;
std::random_device rd;
std::mt19937 mt(rd());
using namespace std;
long long binpow(int a, int u, long long MOD) {
  long long res = 1;
  while (u) {
    if (u & 1) {
      u--;
      res = (res * a) % MOD;
    } else {
      u >>= 1;
      a = (1ll * a * a) % MOD;
    }
  }
  return res;
}
int dp[2001][26];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  int n;
  string s;
  cin >> n >> s;
  char c = '.';
  string S;
  for (auto x : s) {
    if (x != c)
      S += x;
    else
      c = x;
  }
  int N = S.length();
  bitset<2001> used;
  vector<int> L(N + 1, 0);
  for (auto x : S) {
    if (!used[x - 'a']) {
      dp[1][x - 'a']++;
      L[1]++;
    }
    used[x - 'a'] = true;
    for (int len = 2; len <= N; len++) {
      int dif = L[len - 1] - dp[len - 1][x - 'a'] - dp[len][x - 'a'];
      dp[len][x - 'a'] += dif;
      L[len] += dif;
    }
  }
  long long res = 0;
  long long tmp = 1;
  for (int len = 1; len <= n; len++) {
    res = (res + (L[len] * tmp) % 1000000007) % 1000000007;
    tmp = (tmp * (n - len)) % 1000000007;
    tmp = (tmp * binpow(len, 1000000007 - 2, 1000000007)) % 1000000007;
    tmp = (tmp + 1000000007) % 1000000007;
  }
  cout << res << endl;
}
