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 Exponent(long long b, long long p, long long m) {
  if (p == 0)
    return 1;
  else {
    long long result = Exponent(b, p / 2, m);
    result = (result * result) % m;
    if (p % 2 == 1) {
      result = (result * b) % m;
    }
    return result;
  }
}
long long a[210000];
long long e[210000];
long long g[210000];
vector<long long> u, v;
long long mod = 1000000007;
int main() {
  long long i, j, k, l;
  long long n;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> k;
    a[k]++;
  }
  for (i = 0; i < 200001; i++)
    if (a[i]) u.push_back(i);
  for (i = 0; i < 200001; i++)
    if (a[i]) v.push_back(a[i] + 1);
  e[0] = v[0];
  for (i = 1; i < v.size(); i++) {
    k = v[i];
    e[i] = (v[i] * e[i - 1]) % (mod - 1);
  }
  int m = v.size();
  g[m - 1] = v[m - 1];
  for (i = m - 2; i >= 0; i--) {
    k = v[i];
    g[i] = (v[i] * g[i + 1]) % (mod - 1);
  }
  long long ans = 1;
  for (i = 0; i < u.size(); i++) {
    long long mul = u[i];
    k = u[i];
    long long L, R;
    L = 1;
    if (i - 1 >= 0) L = L * e[i - 1];
    if (i + 1 < u.size()) L = (L * g[i + 1]) % (mod - 1);
    for (j = 1; j < v[i]; j++, k *= mul) {
      k %= mod;
      long long s = Exponent(k, L, mod);
      ans = (ans * s) % mod;
    }
  }
  cout << ans;
}
