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;
long long mInv[41];
long long fact[41];
long long factInv[41];
long long getmoduloInv(long long n) {
  if (n == 1) return 1;
  if (mInv[n] > 0) return mInv[n];
  long long m = (-1 * 1000000007) / n;
  m += 1000000007;
  m *= getmoduloInv(1000000007 % n);
  mInv[n] = (m % 1000000007);
  return mInv[n];
}
long long getMul(long long val, long long pow) {
  if (pow == 1) return val;
  if (pow == 0) return 1;
  long long tempVal = getMul(val, pow / 2);
  tempVal = tempVal * tempVal;
  tempVal %= 1000000007;
  if (pow % 2 == 1) {
    tempVal *= val;
    tempVal %= 1000000007;
  }
  return tempVal;
}
long cnt[200005];
int main(void) {
  long long test_cases = 1;
  cout << setprecision(15) << fixed;
  long burstPos = -1;
  long heroes[8];
  long N, M, p;
  long long a, b;
  cin >> M;
  memset(cnt, 0, sizeof(cnt));
  for (long i = 0; i < M; i++) {
    cin >> p;
    cnt[p]++;
  }
  long long num = 1, sqrNum = 1;
  long long mul1 = 1, mul2 = 1;
  bool isSqr = true;
  for (long i = 2; i < 200005; i++) {
    if (cnt[i] > 0) {
      num *= getMul(i, cnt[i]);
      long long sqrMul = getMul(i, cnt[i] / 2);
      num %= 1000000007;
      if (isSqr) {
        sqrNum *= sqrMul;
        sqrNum %= 1000000007;
        if (cnt[i] % 2 == 1) isSqr = false;
      }
    }
  }
  if (!isSqr) {
    long pos = 2;
    while (cnt[pos] % 2 == 0) pos++;
    cnt[pos] /= 2;
  } else
    num = sqrNum;
  long long ans = num;
  for (long i = 2; i < 200005; i++) {
    if (cnt[i] > 0) {
      ans = getMul(ans, cnt[i] + 1);
    }
  }
  cout << ans << endl;
  return 0;
}
