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 mod = 1e9 + 7, siz = 2e5 + 5;
long long t, n, m, c, d, x, k, a[siz], pref[siz], suf[siz];
long long bix(long long a, long long n) {
  if (n == 0) return 1;
  if (n & 1) return a * bix(a, n - 1) % mod;
  long long x = bix(a, n / 2);
  return x * x % mod;
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  map<long long, long long> mp;
  for (long long i = 1; i <= n; i++) cin >> a[i], mp[a[i]]++;
  vector<pair<long long, long long> > v;
  for (auto it : mp) v.push_back({it.first, it.second});
  pref[0] = 1;
  for (long long i = 0; i < v.size(); i++) {
    pref[i + 1] = (pref[i] * (v[i].second + 1)) % (mod - 1);
  }
  suf[v.size() + 1] = 1;
  for (long long i = v.size() - 1; i >= 0; i--) {
    suf[i + 1] = (suf[i + 2] * (v[i].second + 1)) % (mod - 1);
  }
  long long ans = 1;
  for (long long i = 0; i < v.size(); i++) {
    long long times = (pref[i] * suf[i + 2]) % (mod - 1);
    long long po = (v[i].second * (v[i].second + 1)) / 2;
    po %= (mod - 1);
    (po *= times) %= (mod - 1);
    long long mult = bix(v[i].first, po);
    (ans *= mult) %= (mod);
  }
  cout << ans << endl;
}
