Ayrat has number n, represented as it's prime factorization pi of size m, i.e. n = p1·p2·...·pm. Ayrat got secret information that that the product of all divisors of n taken modulo 109 + 7 is the password to the secret data base. Now he wants to calculate this value.

Input

The first line of the input contains a single integer m (1 ≤ m ≤ 200 000) — the number of primes in factorization of n. 

The second line contains m primes numbers pi (2 ≤ pi ≤ 200 000).

Output

Print one integer — the product of all divisors of n modulo 109 + 7.

Examples

Input

2
2 3


Output

36


Input

3
2 3 2


Output

1728

Note

In the first sample n = 2·3 = 6. The divisors of 6 are 1, 2, 3 and 6, their product is equal to 1·2·3·6 = 36.

In the second sample 2·3·2 = 12. The divisors of 12 are 1, 2, 3, 4, 6 and 12. 1·2·3·4·6·12 = 1728.
#include <bits/stdc++.h>
using namespace std;
template <typename A, typename B>
int print_value(A title, B val) {
  cout << title << " = " << val << "\n";
  return 1;
}
int break_point() {
  char c;
  while ((c = getchar()) != '\n')
    ;
  return 0;
}
template <typename A>
int logg(A v) {
  cout << v << "\n";
  return 0;
}
template <typename T>
void read_integer(T &r) {
  bool sign = 0;
  r = 0;
  char c;
  while (1) {
    c = getchar();
    if (c == '-') {
      sign = 1;
      break;
    }
    if (c != ' ' && c != '\n') {
      r = c - '0';
      break;
    }
  }
  while (1) {
    c = getchar();
    if (c == ' ' || c == '\n') break;
    r = r * 10 + (c - '0');
  }
  if (sign) r = -r;
}
void run();
int main() {
  srand(time(NULL));
  do {
    run();
    if (0) {
      0 ? printf("-------------------------------\n") : 0;
      0 ? printf("-------------------------------\n") : 0;
    }
  } while (0);
  return 0;
}
const int mod = 1e9 + 7;
int cnt[200005];
long long p[200005], s[200005];
long long binpow(long long a, long long b) {
  if (b == 0) return 1;
  long long c = binpow(a, b >> 1);
  if (b & 1) return (((c * c) % mod) * a) % mod;
  return (c * c) % mod;
}
void run() {
  int n;
  scanf("%d", &n);
  int t;
  for (int i = 0; i < n; i++) {
    scanf("%d", &t);
    cnt[t]++;
  }
  p[1] = 1;
  for (int i = 2; i < 200001; i++) {
    p[i] = cnt[i] + 1;
    p[i] *= p[i - 1];
    p[i] %= (mod - 1);
  }
  s[200001] = 1;
  for (int i = 200000; i > 1; i--) {
    s[i] = cnt[i] + 1;
    s[i] *= s[i + 1];
    s[i] %= (mod - 1);
  }
  long long res = 1;
  for (int i = 2; i < 200001; i++) {
    if (cnt[i]) {
      long long degree = 1ll * (1 + cnt[i]) * cnt[i] / 2;
      long long v = binpow(i, degree);
      v = binpow(v, (p[i - 1] * s[i + 1]) % (mod - 1));
      res *= v;
      res %= mod;
    }
  }
  printf(0 ? "%lld" : "%I64d", res);
  putchar('\n');
}
