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 custom {
  static uint64_t splitmix64(uint64_t x) {
    x += 0x9e3779b97f4a7c15;
    x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
    x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
    return x ^ (x >> 31);
  }
  size_t operator()(uint64_t x) const {
    static const uint64_t FIXED_RANDOM =
        chrono::steady_clock::now().time_since_epoch().count();
    return splitmix64(x + FIXED_RANDOM);
  }
};
const long long inf = 1e18;
long long power(long long x, long long y) {
  long long res = 1;
  while (y > 0) {
    if (y % 2 == 1) res = ((res) * (x)) % 1000000007;
    x = ((x) * (x)) % 1000000007;
    y = (y >> 1);
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n, m, i, a, b, c, d, x, y, r, p, f = 0;
  cin >> m;
  vector<long long> v;
  unordered_map<long long, long long, custom> mp;
  x = 1, y = 1;
  for (i = 0; i < m; i++) {
    cin >> p;
    if (!mp[p]) v.push_back(p);
    mp[p]++;
  }
  for (i = 0; i < v.size(); i++) {
    if (mp[v[i]] % 2 && f == 0) {
      f = 1;
      a = mp[v[i]] + 1;
      a = a / 2;
      y = (y * a) % (1000000007 - 1);
    } else {
      a = mp[v[i]] + 1;
      y = (y * a) % (1000000007 - 1);
    }
  }
  for (i = 0; i < v.size(); i++) {
    if (!f)
      a = power(v[i], (mp[v[i]]) / 2);
    else
      a = power(v[i], mp[v[i]]);
    x = (x * a) % 1000000007;
  }
  r = power(x, y);
  cout << r << '\n';
}
