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 N = 3e6 + 7, M = 1000000007, inf = INT_MAX;
const long long INF = LLONG_MAX;
long long pwrmod(long long a, long long b, long long mod) {
  long long res = 1;
  a %= mod;
  while (b) {
    if (b & 1) res = (1LL * res * a) % mod;
    a = (1LL * a * a) % mod;
    b >>= 1;
  }
  return res;
}
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  if (0) return;
  cout << name << " : " << arg1 << '\n';
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  if (0) return;
  const char* comma = strchr(names + 1, ',');
  cout.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
void solve() {
  long long n;
  cin >> n;
  map<long long, long long> mp;
  for (long long i = 0; i < (long long)n; i++) {
    long long x;
    cin >> x;
    mp[x]++;
  }
  vector<pair<long long, long long> > vec;
  for (auto& i : mp) vec.push_back({i.first, i.second + 1});
  long long ans = 1;
  long long sz = vec.size();
  vector<long long> suff(sz), pref(sz);
  pref[0] = vec[0].second;
  suff[sz - 1] = vec[sz - 1].second;
  for (long long i = sz - 2; i >= 0; i--)
    suff[i] = (suff[i + 1] * vec[i].second) % (M - 1);
  for (long long i = 1; i < (long long)sz; i++)
    pref[i] = (pref[i - 1] * (vec[i].second)) % (M - 1);
  for (long long i = 0; i < (long long)sz; i++) {
    long long prime = vec[i].first, ex = vec[i].second - 1;
    long long prod = 1;
    if (i != 0) prod *= pref[i - 1], prod %= M - 1;
    if (i != sz - 1) prod *= suff[i + 1], prod %= M - 1;
    long long y = ((ex * (ex + 1)) / 2) % (M - 1);
    y = (y * prod) % (M - 1);
    long long res = pwrmod(prime, y, M);
    ans = (ans * res) % M;
  }
  cout << ans << '\n';
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long test = 1;
  while (test--) solve();
}
