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;
double PI = acos(-1);
int const N = 5e5 + 10, M = 5e6 + 10, oo = 1e9;
const int mod = oo + 7;
const long long OO = 1e18;
int n, cnt[N], aa[N];
vector<pair<int, int> > on;
long long prf[N], suff[N];
long long fst(long long n, int p) {
  if (p == 0) return 1;
  long long res = fst(n, p >> 1);
  res = res * res % mod;
  if (p & 1) res = res * n % mod;
  return res;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) cin >> aa[i], cnt[aa[i]]++;
  long long f = 1;
  for (int i = 0; i < N; i++)
    if (cnt[i]) {
      prf[(int)on.size()] = f;
      on.push_back({i, cnt[i]});
      f *= cnt[i] + 1;
      f %= mod - 1;
    }
  f = 1;
  for (int i = (int)on.size() - 1; i > -1; i--) {
    suff[i] = f;
    f *= on[i].second + 1;
    f %= mod - 1;
  }
  long long an = 1;
  for (int i = 0; i < (int)on.size(); i++) {
    int p = on[i].first, k = on[i].second;
    int y = prf[i] * 1LL * suff[i] % (mod - 1);
    while (k--) {
      an = an * fst(p, y) % mod;
      p = p * 1LL * on[i].first % mod;
    }
  }
  cout << an << endl;
  return 0;
}
