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.

/* 
Keep solving problems. 
*/
import java.util.*;
import java.io.*;

public class CF615D {

    BufferedReader br;
    PrintWriter out;
    StringTokenizer st;
    boolean eof;
    final long MOD = 1000L * 1000L * 1000L + 7;
    class Pair {
        int num;
        int cnt;
        public Pair(int num, int cnt) {
            this.num = num;
            this.cnt = cnt;
        }
    }
    void solve() throws IOException {
        int m = nextInt();
        int len = 200010;
        int[] hist = new int[len];
        for(int i = 0; i < m; i++) {
            hist[nextInt()]++;
        }

        List<Pair> arr = new ArrayList<>();
        for(int i = 0; i < len; i++) {
            if(hist[i] != 0) {
                arr.add(new Pair(i, hist[i]));
            }
        }
        int sz = arr.size();
        long[] pref = new long[sz];
        long[] suff = new long[sz];
        long tmp = 1L;
        for(int i = 0; i < sz; i++) {
            tmp = tmp * (arr.get(i).cnt + 1);
            tmp %= MOD - 1;
            pref[i] = tmp;
        }
        tmp = 1L;
        for(int i = sz - 1; i >= 0; i--) {
            tmp = tmp * (arr.get(i).cnt + 1);
            tmp %= MOD - 1;
            suff[i] = tmp;
        }
        long res = 1;
        for(int i = 0; i < sz; i++) {
            long left;
            long right;
            if(i == 0 && i == sz - 1) {
                left = 1;
                right = 1;
            }
            else if(i == 0) {
                left = 1;
                right = suff[i + 1];
            }
            else if(i == sz - 1) {
                left = pref[i - 1];
                right = 1;
            }
            else {
                left = pref[i - 1];
                right = suff[i + 1];
            }
            long pow = left * right % (MOD - 1);
            pow *= 1L * arr.get(i).cnt * (arr.get(i).cnt + 1) / 2 % (MOD - 1);
            pow %= MOD - 1;
            
            res *= powMod(arr.get(i).num, pow, MOD);
            res %= MOD;
        }
        out(res);
    }
    public long powMod(long N, long M, long MOD){//N^M % MOD
        if(M == 0L)
            return 1L;
        long[] hp = new long[64];
        boolean[] bp = new boolean[64];
        hp[0] = N;
        //hp[1] = N;
        for(int i = 1; i < hp.length; i++) {
            hp[i] = (hp[i - 1] * hp[i - 1]) % MOD;
        }
        for(int j = 0; j < hp.length; j++) {
            if((M & (1L << j)) != 0)
                bp[j] = true;
        }
        long res = 1;
        for(int i = 0;i < bp.length; i++){
            if(bp[i]) {
                res = (res * hp[i]) % MOD;
            }
        }
        return res;
    }

    void shuffle(int[] a) {
        int n = a.length;
        for(int i = 0; i < n; i++) {
            int r = i + (int) (Math.random() * (n - i));
            int tmp = a[i];
            a[i] = a[r];
            a[r] = tmp;
        }
    }
    private void outln(Object o) {
        System.out.println(o);
    }
    private void out(Object o) {
        System.out.print(o);
    }
    public CF615D() throws IOException {
        br = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        solve();
        out.close();
    }
    public static void main(String[] args) throws IOException {
        new CF615D();
    }

    public long[] nextLongArr(int n) throws IOException{
        long[] res = new long[n];
        for(int i = 0; i < n; i++)
            res[i] = nextLong();
        return res;
    }
    public int[] nextIntArr(int n) throws IOException {
        int[] res = new int[n];
        for(int i = 0; i < n; i++)
            res[i] = nextInt();
        return res;
    }
    public String nextToken() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (Exception e) {
                eof = true;
                return null;
            }
        }
        return st.nextToken();
    }
    public String nextString() {
        try {
            return br.readLine();
        } catch (IOException e) {
            eof = true;
            return null;
        }
    }
    public int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }
    public long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }
    public double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }
}

