#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O2")
#pragma GCC optimize("unroll-loops")
const int N = 5000 + 5, md = 1e9 + 7;
int n;
string s;
long long dp[N][27], fac[N], ifac[N], ans = 0;
long long pw(long long x, int tav) {
  long long ans = 1;
  while (tav) {
    if (tav & 1) ans = ans * x % md;
    x = x * x % md;
    tav >>= 1;
  }
  return ans;
}
long long c(int x, int y) { return (fac[x] * ifac[y] % md) * ifac[x - y] % md; }
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  fac[0] = 1;
  for (int i = 1; i < N; i++) fac[i] = fac[i - 1] * i % md;
  ifac[N - 1] = pw(fac[N - 1], md - 2);
  for (int i = N - 2; i >= 0; i--) ifac[i] = ifac[i + 1] * (i + 1) % md;
  cin >> n >> s;
  for (int i = 0; i < n; i++) {
    if (i && s[i] == s[i - 1]) continue;
    dp[1][s[i] - 'a'] = 1;
    for (int j = 2; j <= i + 1; j++) {
      dp[j][s[i] - 'a'] = 0;
      for (int k = 0; k < 26; k++)
        if (k != s[i] - 'a')
          dp[j][s[i] - 'a'] = (dp[j][s[i] - 'a'] + dp[j - 1][k]) % md;
    }
  }
  for (int i = 1; i <= n; i++) {
    long long sd = 0;
    for (int j = 0; j < 27; j++) sd = (dp[i][j] + sd) % md;
    ans += sd * c(n - 1, i - 1) % md;
    ans %= md;
  }
  cout << ans << '\n';
}
