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

public class D {

    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);

        Solver solver = new Solver();
        solver.solve(1, in, out);

        out.close();
    }

    static class Solver {

        final static long MOD = 1000000007;

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            long n = in.nextLong();
            long result = 1;
            HashMap< Integer, Integer> map = new HashMap< Integer, Integer>();
            for (int i = 0; i < n; i++) {
                int x = in.nextInt();
                if (map.containsKey(x)) {
                    map.put(x, map.get(x) + 1);
                } else {
                    map.put(x, 1);
                }
            }
            long d = 1;
            for (int p : map.keySet()) {
                long cnt = map.get(p);
                long f = calc_pow(p, (cnt + 1) * cnt / 2);
                result = calc_pow(result , cnt + 1) * calc_pow(f , d) % MOD;
                d = d * (cnt + 1) % (MOD - 1);
            }
            out.println(result);
        }

        public long calc_pow(long a, long b) {
            if (b == 0) {
                return 1;
            }
            if (b % 2 == 1) {
                return (calc_pow(a, b - 1) * a) % MOD;
            } else {
                long c = calc_pow(a, b / 2) % MOD;
                return (c * c) % MOD;
            }
        }
    }

    static class InputReader {

        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

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

        public long nextLong() {
            return Long.parseLong(next());
        }

    }
}
