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 power(long long x, long long y, long long p) {
  long long res = 1;
  x = x % p;
  if (x == 0) return 0;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
long long modInverse(long long a, long long m) {
  long long m0 = m;
  long long y = 0, x = 1;
  if (m == 1) return 0;
  while (a > 1) {
    long long q = a / m;
    long long t = m;
    m = a % m, a = t;
    t = y;
    y = x - q * y;
    x = t;
  }
  if (x < 0) x += m0;
  return x;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long m, n, mod = 1e9 + 7, flag = 0;
  cin >> m;
  map<long long, long long> ma;
  for (long long i = 0; i < m; i++) {
    cin >> n;
    ma[n]++;
  }
  long long prod = 1;
  for (auto it = ma.begin(); it != ma.end(); it++) {
    long long hh = it->second + 1;
    if (flag == 0) {
      if (hh % 2 == 0) {
        hh = hh / 2;
        flag++;
      }
    }
    prod *= hh;
    prod = prod % (mod - 1);
  }
  long long ans = 1;
  for (auto it = ma.begin(); it != ma.end(); it++) {
    long long k = it->second;
    if (flag == 0) k = k / 2;
    long long gg = prod;
    gg = gg % (mod - 1);
    gg *= k % (mod - 1);
    gg = gg % (mod - 1);
    if (gg < 0) gg = (gg + mod - 1) % (mod - 1);
    ans *= power(it->first, gg, mod);
    ans = ans % mod;
  }
  cout << ans << '\n';
}
