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.*;
import java.util.HashMap;
import java.util.StringTokenizer;

public class D {

    final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;
    BufferedReader in;
    PrintWriter out;
    StringTokenizer tok = new StringTokenizer("");

	void solve() throws IOException {
        int mod = 1000 * 1000 * 1000 + 7;
        int n = readInt();
        int[] count = new int[200001];
        for(int i = 0; i < n; i++) {
            int x = readInt();
            count[x]++;
        }

        long[] pref = new long[200001];
        pref[0] = 1;
        for(int i = 1; i < 200001; i++) {
            pref[i] = pref[i-1] * (count[i] + 1) % (mod-1);
        }
        long[] suff = new long[200001];
        suff[200000] = 1;
        for(int i = 199999; i >= 0; i--) {
            suff[i] = suff[i+1] * (count[i] + 1) % (mod-1);
        }

        long ans = 1;
        for(int i = 1; i < 200001; i++) {
            if(count[i] == 0) continue;

            long other = pref[i-1] * suff[i+1] % (mod-1);
            long cur = i;
            for(int j = 0; j < count[i]; j++) {
                long tmp = binpow(cur, other, mod);
                ans = ans * tmp % mod;
                cur = cur * i % mod;
            }
        }
        out.println(ans);
	}

    long binpow (long a, long n, long mod) {
        long res = 1;
        while (n != 0) {
            if (n % 2 != 0) {
                res *= a;
                res %= mod;
            }
            a *= a;
            a %= mod;
            n >>= 1;
        }
        return res;
    }


    void init() throws FileNotFoundException {
        if (ONLINE_JUDGE) {
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
        } else {
            in = new BufferedReader(new FileReader("input.txt"));
            out = new PrintWriter("output.txt");
        }
    }

    String readString() throws IOException {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine());
        }
        return tok.nextToken();
    }

    int readInt() throws IOException {
        return Integer.parseInt(readString());
    }

    long readLong() throws IOException {
        return Long.parseLong(readString());
    }

    double readDouble() throws IOException {
        return Double.parseDouble(readString());
    }

    int[] readArr(int n) throws IOException {
        int[] res = new int[n];
        for (int i = 0; i < n; i++) {
            res[i] = readInt();
        }
        return res;
    }

    long[] readArrL(int n) throws IOException {
        long[] res = new long[n];
        for (int i = 0; i < n; i++) {
            res[i] = readLong();
        }
        return res;
    }

    public static void main(String[] args) {
        new D().run();
    }

    public void run() {
        try {
            long t1 = System.currentTimeMillis();
            init();
            solve();
            out.close();
            long t2 = System.currentTimeMillis();
            System.err.println("Time = " + (t2 - t1));
        } catch (Exception e) {
            e.printStackTrace(System.err);
            System.exit(-1);
        }
    }
}