#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:100000000000000")
using namespace std;
long long n, cnt[5], fct[1000001];
pair<long long, long long> dp[1000001];
string st;
map<char, int> mp;
long long pw(long long a, long long b) {
  if (b == 0) return 1;
  if (b == 1) return a;
  long long ret = pw(a, b / 2);
  (ret *= ret) %= 1000000007;
  if (b & 1) (ret *= a) % 1000000007;
  return ret;
}
pair<long long, long long> rec(int lef) {
  if (lef == 0) return make_pair(0, 1);
  if (~dp[lef].first) return dp[lef];
  pair<long long, long long> ret = make_pair(0, 0);
  for (int i = 0; i < 4; i++) {
    pair<long long, long long> tmp = rec(lef - 1);
    tmp.first += cnt[i];
    if (tmp.first == ret.first)
      (ret.second += tmp.second) %= 1000000007;
    else if (tmp.first > ret.first)
      ret = tmp;
  }
  return dp[lef] = ret;
}
int main() {
  cin >> n >> st;
  mp['A'] = 0;
  mp['C'] = 1;
  mp['G'] = 2;
  mp['T'] = 3;
  fct[0] = fct[1] = 1;
  for (int i = 0; i < st.size(); i++) cnt[mp[st[i]]]++;
  for (int i = 2; i < 1000001; i++) fct[i] = (fct[i - 1] * i) % 1000000007;
  memset((dp), (-1), sizeof(dp));
  pair<long long, long long> x = rec(n);
  cout << x.second << endl;
  return 0;
}
