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>
#pragma comment(linker, "/STACK:16777216")
using namespace std;
int main() {
  iostream::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  int n;
  cin >> n;
  string s;
  cin >> s;
  for (char &c : s) c -= 'a';
  vector<long long> sum(n + 1, 0);
  sum[0] = 1;
  vector<vector<long long> > dp(n + 1, vector<long long>(26, 0));
  const long long md = 1e9 + 7;
  for (char c : s) {
    for (int i = n; i; i--) {
      sum[i] += sum[i - 1] - dp[i - 1][c] - dp[i][c];
      dp[i][c] = sum[i - 1] - dp[i - 1][c];
      sum[i] %= md;
      dp[i][c] += md;
    }
  }
  vector<vector<long long> > c(n + 1, vector<long long>(n + 1, 0));
  c[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= n; j++) {
      if (j) c[i][j] += c[i - 1][j - 1];
      c[i][j] += c[i - 1][j];
      c[i][j] %= md;
    }
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    ans += ((sum[i] + md) * c[n - 1][i - 1]) % md;
    ans %= md;
  }
  cout << ans;
  return 0;
}
