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;
using ll = long long int;
using ull = unsigned long long int;
using dd = double;
using ldd = long double;
ll mod = 1e9 + 7;
int _size = 1 << 18;
vector<ll> tree(_size << 1, 1);
ll get(int v, int l, int r, int fl, int fr) {
  if (r <= l || fr <= l || r <= fl) return 1;
  if (fl <= l && r <= fr) return tree[v];
  return get(v << 1, l, (r + l) >> 1, fl, fr) *
         get(v << 1 | 1, (r + l) >> 1, r, fl, fr) % (mod - 1);
}
ll bp(ll a, ll n) {
  ll ans = 1;
  while (n) {
    if (n & 1) ans = ans * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return ans;
}
void solve() {
  int n;
  cin >> n;
  map<int, int> hv;
  for (int i = 0; i < n; ++i) {
    int x;
    cin >> x;
    ++hv[x];
  }
  ll mp = 1;
  for (auto k : hv) {
    tree[_size + k.first] = k.second + 1;
  }
  for (int i = _size - 1; i > 0; --i)
    tree[i] = tree[i << 1] * tree[i << 1 | 1] % (mod - 1);
  ll ans = 1;
  for (auto j : hv) {
    mp = get(1, 0, _size, 0, j.first) * get(1, 0, _size, j.first + 1, _size) %
         (mod - 1);
    ll MU = 1;
    ll curr = 1;
    for (int i = 0; i < j.second; ++i) {
      curr = curr * j.first % mod;
      MU = MU * curr % mod;
    }
    ans = ans * bp(MU, mp) % mod;
    mp = mp * (j.second + 1) % mod;
  }
  cout << ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int t;
  t = 1;
  for (int i = 0; i < t; ++i) solve();
  return 0;
}
