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.
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskD solver = new TaskD();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskD {
        long MOD = 1_000_000_007;

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int m = in.nextInt();
            int[] p = new int[m];
            int cnt[] = new int[200_001];
            for (int i = 0; i < m; i++) {
                p[i] = in.nextInt();
                cnt[p[i]]++;
            }
            long d = 1;
            long ans = 1;
            for (int i = 0; i <= 200_000; i++) {
                if (cnt[i] == 0) continue;
                long fp = binPow(i, (cnt[i] + 1L) * cnt[i] / 2);
                ans = (binPow(ans, (cnt[i] + 1L)) * binPow(fp, d)) % MOD;
                d = (d * (cnt[i] + 1L)) % (MOD - 1);
            }
            out.println(ans);
        }

        long binPow(long a, long b) {
            if (b == 0) {
                return 1;
            }
            if (b == 1) {
                return a;
            }
            long res2 = binPow(a, b / 2);
            res2 = (res2 * res2) % MOD;
            if (b % 2 == 0)
                return res2;
            return (res2 * a) % MOD;
        }

    }

    static class InputReader {
        private BufferedReader reader;
        private StringTokenizer stt;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
        }

        public String nextLine() {
            try {
                return reader.readLine();
            } catch (IOException e) {
                return null;
            }
        }

        public String next() {
            while (stt == null || !stt.hasMoreTokens()) {
                stt = new StringTokenizer(nextLine());
            }
            return stt.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}

