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 long long SIZE = 1e5 * 3 + 10, MOD = 1e9 + 7, phi = 500000002;
map<long long, long long> cnt;
vector<long long> vec;
long long gcd(long long a, long long b, long long& x, long long& y) {
  if (a == 0) {
    x = 0;
    y = 1;
    return b;
  }
  long long x1, y1;
  long long d = gcd(b % a, a, x1, y1);
  x = y1 - (b / a) * x1;
  y = x1;
  return d;
}
long long rev_mod(long long a, long long mod) {
  long long x, y;
  long long g = gcd(a, mod, x, y);
  if (g != 1)
    abort();
  else {
    x = (x % mod + mod) % mod;
    return x;
  }
}
long long binpow(long long a, long long n, long long md = MOD) {
  if (n == 0) return 1;
  if (n % 2 == 1)
    return (binpow(a, n - 1) * a) % md;
  else {
    long long b = binpow(a, n / 2);
    return (b * b) % md;
  }
}
signed main() {
  cin.tie(0);
  cout.tie(0);
  ios_base::sync_with_stdio(0);
  ;
  long long m;
  cin >> m;
  vec.resize(m);
  long long s = 1, mul = 1;
  vector<long long> fact;
  fact.push_back(0);
  for (long long i = 1; i < m + 10; i++)
    fact.push_back((fact.back() + i) % (MOD - 1));
  for (long long i = 0; i < m; i++) {
    cin >> vec[i];
    cnt[vec[i]]++;
  }
  for (auto cur : cnt) {
    mul *= (cur.second + 1);
    mul %= MOD - 1;
  }
  long long nows = 1;
  for (auto cur : cnt) {
    long long pw = binpow(cur.first, (cur.second + 1) * cur.second / 2, MOD);
    s = binpow(s, (cur.second + 1), MOD) * binpow(pw, nows, MOD);
    nows = (nows * (cur.second + 1)) % (MOD - 1);
    s %= MOD;
  }
  cout << s;
  return 0;
}
