#include <bits/stdc++.h>
using namespace std;
int dp[5100][5100];
int s[5100];
int comb[5100][5100];
int main() {
  int n;
  s[0] = 1;
  string sir;
  cin >> n >> sir;
  for (int i(0); i < sir.size(); i++) {
    if (i && sir[i] == sir[i - 1]) continue;
    char c(sir[i] - 'a');
    for (int i(1); i <= n; i++) {
      s[i] = (s[i] - dp[i][c] + 1000000007ll) % 1000000007ll;
      dp[i][c] = (s[i - 1] - dp[i - 1][c] + 1000000007ll) % 1000000007ll;
      s[i] = (s[i] + dp[i][c]) % 1000000007ll;
    }
  }
  for (int i(0); i <= n; i++) comb[i][0] = 1;
  for (int i(1); i <= n; i++)
    for (int j(1); j <= n; j++)
      comb[i][j] = (comb[i - 1][j] + comb[i - 1][j - 1]) % 1000000007ll;
  long long ans(0);
  for (int i(1); i <= n; i++)
    ans = (ans + 1ll * s[i] * comb[n - 1][i - 1]) % 1000000007ll;
  cout << ans;
  return 0;
}
