#include <bits/stdc++.h>
const long long mod = 1000000007;
int a[4], m = -1;
int read() {
  char c = getchar();
  while (c != 'A' && c != 'C' && c != 'G' && c != 'T') {
    c = getchar();
  }
  while (c == 'A' || c == 'C' || c == 'G' || c == 'T') {
    if (c == 'A') a[0]++;
    if (c == 'C') a[1]++;
    if (c == 'G') a[2]++;
    if (c == 'T') a[3]++;
    c = getchar();
  }
  m = m > a[0] ? m : a[0];
  m = m > a[1] ? m : a[1];
  m = m > a[2] ? m : a[2];
  m = m > a[3] ? m : a[3];
  int ans = 0;
  for (int i = 0; i <= 3; i++) {
    if (a[i] == m) ans++;
  }
  return ans;
}
long long Pow(long long a, long long n) {
  long long ans = 1, tmp = a;
  while (n) {
    if (n & 1) ans = ans * tmp % mod;
    tmp = tmp * tmp % mod;
    n >>= 1;
  }
  return ans;
}
int main() {
  int n;
  scanf("%d", &n);
  memset(a, 0, sizeof(a));
  int num = read();
  long long ans = Pow(num, n);
  printf("%I64d\n", ans);
}
