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;
bool isprime[1000001];
vector<pair<long long, long long> > fact;
map<long long, long long> m;
map<long long, long long>::iterator it;
long long bigmod(long long b, long long p) {
  if (p == 0) return 1;
  if (p == 1)
    return b % 1000000007;
  else if (p % 2 == 0)
    return (bigmod(b, p / 2) * bigmod(b, p / 2)) % 1000000007;
  else
    return (((bigmod(b, p / 2) * bigmod(b, p / 2)) % 1000000007) * b) %
           1000000007;
}
signed main() {
  long long mm, tar, cur, c;
  cin >> mm;
  for (long long i = 0; i < mm; i++) {
    cin >> tar;
    m[tar]++;
  }
  it = m.begin();
  while (it != m.end()) {
    fact.push_back({it->first, it->second});
    it++;
  }
  c = 1;
  for (long long i = 0; i < fact.size(); i++) {
    c *= (fact[i].second + 1);
    c %= 2 * (1000000007 - 1);
  }
  cur = 1;
  for (long long i = 0; i < fact.size(); i++) {
    cur *= bigmod(bigmod(fact[i].first, fact[i].second), c / 2);
    cur %= 1000000007;
  }
  long long key = 0;
  for (long long i = 0; i < fact.size(); i++) {
    if (fact[i].second % 2 == 1) key = 1;
  }
  if (key == 0) {
    for (long long i = 0; i < fact.size(); i++) {
      cur *= bigmod(fact[i].first, fact[i].second / 2);
      cur %= 1000000007;
    }
  }
  cout << cur << endl;
}
