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 MAXN = 2e5 + 5;
const long long MOD = 1e9 + 7;
map<int, int> lst;
long long suf[MAXN], pref[MAXN];
long long pr[MAXN], cnt[MAXN];
long long add(long long a, long long b, long long MOD) { return (a + b) % MOD; }
long long mul(long long a, long long b, long long MOD) {
  return (a * b + MOD) % MOD;
}
long long binpow(long long a, long long st, long long MOD) {
  long long ans = 1;
  for (; st; st >>= 1) {
    if (st & 1) {
      ans = mul(ans, a, MOD);
    }
    a = mul(a, a, MOD);
  }
  return ans;
}
void solve() {
  int m;
  cin >> m;
  int p;
  for (int i = 0; i < m; i++) {
    scanf("%d", &p);
    lst[p]++;
  }
  long long r2 = MOD - 1;
  map<int, int>::iterator it;
  int top = 0;
  for (it = lst.begin(); it != lst.end(); it++) {
    p = it->first;
    int cur = it->second;
    pr[top] = p;
    cnt[top++] = cur;
  }
  pref[0] = cnt[0] + 1;
  for (int i = 1; i < top; i++) {
    pref[i] = mul(pref[i - 1], cnt[i] + 1, r2);
  }
  suf[top - 1] = cnt[top - 1] + 1;
  for (int i = top - 2; i >= 0; i--) {
    suf[i] = mul(suf[i + 1], cnt[i] + 1, r2);
  }
  long long ans = 1;
  for (int i = 0; i < top; i++) {
    long long fs = (i ? pref[i - 1] : 1);
    long long sc = (i + 1 < top ? suf[i + 1] : 1);
    long long deg = mul(fs, sc, r2);
    long long sum = (1ll + cnt[i]) * cnt[i] / 2;
    sum %= r2;
    deg = mul(deg, sum, r2);
    ans = mul(ans, binpow(pr[i], deg, MOD), MOD);
  }
  cout << ans;
}
int main() {
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
