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 ull = unsigned long long;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename T>
T gcd(T a, T b) {
  a = abs(a), b = abs(b);
  while (b > 0) {
    tie(a, b) = make_pair(b, a % b);
  }
  return a;
}
constexpr long long INF = 1LL << 60;
constexpr int inf = 1000000007;
constexpr long long mod = 1000000007LL;
constexpr int MAX = 1100000;
struct mint {
  long long x;
  mint(long long x = 0) : x((x % mod + mod) % mod) {}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod - a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res -= a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res *= a;
  }
  mint pow(long long t) const {
    if (!t) return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1) a *= *this;
    return a;
  }
  mint inv() const { return pow(mod - 2); }
  mint& operator/=(const mint a) { return (*this) *= a.inv(); }
  mint operator/(const mint a) const {
    mint res(*this);
    return res /= a;
  }
};
long long power(long long x, long long n, long long p = INF) {
  if (n == 0) {
    return 1 % p;
  }
  if (n % 2 == 0) {
    return power(x * x % p, n / 2, p);
  } else {
    return x * power(x, n - 1, p) % p;
  }
}
int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int m;
  cin >> m;
  vector<mint> dp(2);
  vector<long long> cnt(2);
  int cur = 0;
  int nxt = 1;
  dp[cur] = 1;
  cnt[0] = 1;
  vector<long long> cp(200000);
  for (int i = 0; i < m; i++) {
    long long p;
    cin >> p;
    cp[p]++;
  }
  for (int i = 2; i < 200000; i++) {
    if (cp[i] == 0) continue;
    dp[nxt] = 1;
    cnt[nxt] = 0;
    cnt[nxt] += cnt[cur] * (cp[i] + 1) % (mod - 1);
    cnt[nxt] %= (mod - 1);
    mint t = 1;
    for (int j = 0; j <= cp[i]; j++) {
      dp[nxt] *= dp[cur] * mint(t.x).pow(cnt[cur]);
      t *= i;
    }
    swap(cur, nxt);
  }
  cout << dp[cur].x << "\n";
}
