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;
long long mod = 1000000007;
long long pow(long long a, long long x) {
  if (x == 0) return 1LL;
  long long temp = pow(a, x / 2);
  long long ans = (temp * temp) % mod;
  if (x % 2) {
    return (ans * a) % mod;
  }
  return ans;
}
int main() {
  long long ans = 0;
  vector<long long> primes;
  int m;
  cin >> m;
  map<long long, long long> c;
  while (m--) {
    long long temp;
    cin >> temp;
    if (c.find(temp) == c.end()) {
      c[temp] = 0;
      primes.push_back(temp);
    }
    c[temp]++;
  }
  sort(primes.begin(), primes.end());
  int n = (int)primes.size();
  vector<long long> pre(n + 10, 0), suf;
  suf = pre;
  long long prefix = 1;
  for (int i = 0; i < n; i++) {
    pre[i] = prefix;
    prefix = (prefix * (c[primes[i]] + 1)) % (mod - 1);
  }
  long long suffix = 1;
  for (int i = n - 1; i >= 0; i--) {
    suf[i] = suffix;
    suffix = (suffix * (c[primes[i]] + 1)) % (mod - 1);
  }
  vector<long long> co(n + 10, 0);
  for (int i = 0; i < n; i++) {
    co[i] = (c[primes[i]] * (c[primes[i]] + 1) / 2) % (mod - 1);
  }
  vector<long long> power(n + 10, 0);
  for (int i = 0; i < n; i++) {
    power[i] = (co[i] * pre[i]) % (mod - 1);
    power[i] = (power[i] * suf[i]) % (mod - 1);
  }
  ans = 1;
  for (int i = 0; i < n; i++) {
    ans = (ans * pow(primes[i], power[i])) % mod;
  }
  cout << ans << endl;
}
