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;
const int N = 2e5 + 5, MOD = 1000000007;
int n, k, t;
long long m;
int freq[N];
long long fo[N];
long long ba[N];
int fastPow(long long a, int p) {
  if (p == 1) return a;
  if (p % 2) {
    return (a * fastPow((a * a) % MOD, p / 2)) % MOD;
  } else
    return fastPow((a * a) % MOD, p / 2) % MOD;
}
int modInv(int a) { return fastPow(a, MOD - 2); }
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &t);
    ++freq[t];
  }
  m = 1;
  fo[0] = freq[0] + 1;
  for (int i = 1; i < N; ++i) {
    if (!freq[i])
      fo[i] = fo[i - 1];
    else if (!fo[i - 1])
      fo[i] = freq[i] + 1;
    else
      fo[i] = (fo[i - 1] * (freq[i] + 1)) % (MOD - 1);
  }
  ba[N - 1] = freq[N - 1] + 1;
  for (int i = N - 2; i > -1; --i) {
    if (!freq[i])
      ba[i] = ba[i + 1];
    else if (!ba[i + 1])
      ba[i] = freq[i] + 1;
    else
      ba[i] = (ba[i + 1] * (freq[i] + 1)) % (MOD - 1);
  }
  long long ans = 1;
  for (int i = 0; i < N; ++i) {
    m = 1;
    if (!freq[i]) continue;
    long long num = i, bignum = 1;
    for (int x = 0; x < freq[i]; ++x) {
      bignum *= num;
      bignum %= MOD;
      num *= i;
      num %= MOD;
    }
    if (i && fo[i - 1]) {
      m *= fo[i - 1] % (MOD - 1);
      m %= (MOD - 1);
    }
    if (i < N - 1 && ba[i + 1]) {
      m *= ba[i + 1] % (MOD - 1);
      m %= (MOD - 1);
    }
    ans *= fastPow(bignum, m) % MOD;
    ans %= MOD;
  }
  printf("%lld\n", ans);
}
