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.util.*;
public class vector {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc=new Scanner(System.in);
		int m=sc.nextInt();
		HashMap<Long, Integer> map=new HashMap<Long, Integer>();
		HashSet<Long> hs=new HashSet<Long>();
		int ct=0;
		long mp=1;
		boolean first=true;
		long value=0;
		long h=(long) Math.pow(10, 9)+7;
        for (int i=0; i<m; i++) {
        	
			Long p=sc.nextLong();
			if (map.containsKey(p)) {
				if (hs.contains(p)) {
					hs.remove(p);
				}
				int v=map.get(p)+1;
				map.put(p, v);
				mp=(mp*p)%h;
			}
			else {
				if (first) {
					value=p;
					first=false;
				}
				hs.add(p);
				mp=(mp*p)%h;
				map.put(p, 1);
			}
		}
       
        if (hs.size()>0){
         	
            for (Long j : map.keySet()) {
    			long rec=map.get(j);
    			if (rec==1) {
    				ct++;
    			}
    			else {
    				long exp=rec+1;
    				long res=1;
    				long k=mp;
    				while(exp>0) {
    					if (exp%2==0) {
    						k=(k*k)%h;
    						exp=exp/2;
    					}
    					else {
    						res=(res*k)%h;
    						exp--;
    					}
    					
    				}
    				mp=res%h;
    			
    			}
    			
    		}
            
            for(int i=1; i<ct; i++) {
            	mp=(mp*mp)%h;
            }
            System.out.println(mp);
            
            
            
        }
        else {
        	
        	long ex=1;
        	mp=1;
        	boolean pair=false;
            for (Long j : map.keySet()) {
            	long rec=map.get(j);
            	if (rec%2==1 && pair==false) {
            		pair=true;
            		ex=((ex*(rec+1))/2)%(h-1);
            	}
            	else {
            		ex=(ex*(rec+1))%(h-1);
            	}
            }
            for (Long j : map.keySet()) {
            	long fr=1;
            	if (!pair) {
            		fr=((ex*map.get(j))/2)%(h-1);
            	}
            	else {
            		fr=(ex*map.get(j))%(h-1);
            	}
            	long res=1;
     			long k=j;
     			while(fr>0) {
     				if (fr%2==0) {
     					k=(k*k)%h;
     					fr=fr/2;
     				}
     				else {
     					res=(res*k)%h;
     					fr--;
     				}
     				
     			}
     			
     			mp=(mp*res)%h;
     			
            }
            
          
            	 System.out.println(mp);
                 
            
           
        
       
        }
		
		
		
		

	}

}
