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;
template <class T>
ostream& operator<<(ostream& fout, const vector<T>& vec) {
  for (size_t i = 0; i < vec.size(); ++i) {
    fout << vec[i] << ' ';
  }
  return fout;
}
template <class T>
istream& operator>>(istream& fin, vector<T>& vec) {
  for (size_t i = 0; i < vec.size(); ++i) {
    cin >> vec[i];
  }
  return fin;
}
class Solution {
 private:
 public:
  static Solution& GetInstance() {
    static Solution instance;
    return instance;
  }
  int mod = 1000000007;
  int64_t pow_c(int64_t a, int64_t r) {
    if (r == 0) return 1;
    if (r % 2 == 0) {
      int64_t res = pow_c(a, r / 2) % mod;
      return (res * res) % mod;
    } else {
      return (a * pow_c(a, r - 1)) % mod;
    }
  }
  void Read() {
    int n;
    cin >> n;
    vector<int64_t> counter(220000, 1);
    for (int i = 0; i < n; ++i) {
      int cur;
      cin >> cur;
      ++counter[cur];
    }
    vector<int64_t> suf(220000);
    vector<int64_t> pref(220000);
    int64_t cur = 1;
    for (int i = 200001; i >= 0; --i) {
      cur *= counter[i];
      cur %= mod - 1;
      suf[i] = cur;
    }
    cur = 1;
    for (int i = 0; i <= 200001; ++i) {
      cur *= counter[i];
      cur %= mod - 1;
      pref[i] = cur;
    }
    int64_t result = 1;
    for (int i = 2; i <= 200000; ++i) {
      int64_t pow = ((counter[i] - 1) * counter[i]) / 2;
      pow %= mod - 1;
      pow *= suf[i + 1];
      pow %= mod - 1;
      pow *= pref[i - 1];
      pow %= mod - 1;
      result *= pow_c(i, pow);
      result %= mod;
    }
    cout << result << '\n';
  }
  void Solve() {}
  void Output() {}

 private:
  Solution() {}
  Solution(const Solution&);
  Solution(const Solution&&);
};
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  auto& solution = Solution::GetInstance();
  solution.Read();
  solution.Solve();
  solution.Output();
  return 0;
}
