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;
inline bool is_palindrome(const string& s) {
  return std::equal(s.begin(), s.end(), s.rbegin());
}
const long long MOD = 1000000007;
const long long INF = 1e9 + 5;
const double eps = 1e-7;
const double PI = acos(-1.0);
inline void debug_vi(vector<int> a) {
  for (long long i = (long long)(0); i < (long long)(a.size()); i++)
    cout << a[i] << " ";
}
inline void debug_vll(vector<long long> a) {
  for (long long i = (long long)(0); i < (long long)(a.size()); i++)
    cout << a[i] << " ";
}
const int N = 5005;
long long dp[N][26], totalsum[N], last[26] = {-1}, n, sz;
string s, t;
const int MAXN = 1e4 + 5;
long long factorial[MAXN], inverse[MAXN];
long long power(long long x, long long y, long long p) {
  long long res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
long long modInverse(long long a, long long m) { return power(a, m - 2, m); }
void pre() {
  factorial[0] = 1LL;
  inverse[0] = modInverse(factorial[0], MOD);
  for (int i = 1; i < MAXN; i++) {
    factorial[i] = factorial[i - 1] * i % MOD;
    inverse[i] = modInverse(factorial[i], MOD);
  }
}
long long binomial_coefficient(long long n, long long k) {
  return factorial[n] * inverse[k] % MOD * inverse[n - k] % MOD;
}
int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> sz >> t;
  pre();
  s = "";
  char prev = t[0];
  for (long long i = (long long)(1); i < (long long)(t.size()); i++) {
    if (t[i] == prev) continue;
    s.push_back(prev);
    prev = t[i];
  }
  s.push_back(prev);
  memset(dp, 0, sizeof(dp));
  memset(totalsum, 0, sizeof(totalsum));
  memset(last, -1, sizeof(last));
  n = s.size();
  totalsum[0] = 1;
  for (long long i = (long long)(0); i < (long long)(n); i++) {
    int val = s[i] - 'a';
    for (long long j = (long long)(1); j < (long long)(i + 2); j++) {
      totalsum[j] = (totalsum[j] - dp[j][val] + MOD) % MOD;
      totalsum[j] =
          totalsum[j] + (totalsum[j - 1] - dp[j - 1][val] + MOD) % MOD;
      dp[j][val] = (totalsum[j - 1] - dp[j - 1][val] + MOD) % MOD;
    }
  }
  long long ans = 0;
  for (long long i = (long long)(1); i < (long long)(n + 1); i++) {
    ans += (totalsum[i] * binomial_coefficient(sz - 1, i - 1)) % MOD;
    ans %= MOD;
  }
  cout << ans;
  return 0;
}
