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;
struct edge {
  int u, v;
  long long w;
};
long long MOD = 1000000007;
long long _MOD = 1000000009;
double EPS = 1e-10;
long long extgcd(long long a, long long b, long long& x, long long& y) {
  if (b == 0) {
    x = (a >= 0) ? 1 : -1;
    y = 0;
    return abs(a);
  } else {
    long long res = extgcd(b, a % b, y, x);
    y -= (a / b) * x;
    return res;
  }
}
long long mod_inverse(long long a, long long m) {
  long long x, y;
  extgcd(a, m, x, y);
  return (m + x % m) % m;
}
int pow_mod(long long x, long long n, int m) {
  long long res = 1;
  for (; n > 0; n >>= 1) {
    if (n & 1) res = (res * x) % m;
    x = (x * x) % m;
  }
  return res;
}
int main() {
  vector<int> a(200001);
  int m;
  cin >> m;
  while (m--) {
    int p;
    cin >> p;
    a[p]++;
  }
  long long x = 1;
  bool unko = false;
  for (int p = 2; p <= 200000; p++) {
    if (!a[p]) continue;
    if (!unko && (a[p] + 1) % 2 == 0) {
      unko = true;
      x = x * ((a[p] + 1) / 2) % (MOD - 1);
    } else
      x = x * (a[p] + 1) % (MOD - 1);
  }
  long long ans = 1;
  for (int p = 2; p <= 200000; p++) {
    if (!a[p]) continue;
    long long y;
    if (unko)
      y = x * a[p] % (MOD - 1);
    else
      y = x * (a[p] / 2) % (MOD - 1);
    ans = ans * pow_mod(p, y, MOD) % MOD;
  }
  cout << ans << endl;
}
