Little Dima has two sequences of points with integer coordinates: sequence (a1, 1), (a2, 2), ..., (an, n) and sequence (b1, 1), (b2, 2), ..., (bn, n).

Now Dima wants to count the number of distinct sequences of points of length 2·n that can be assembled from these sequences, such that the x-coordinates of points in the assembled sequence will not decrease. Help him with that. Note that each element of the initial sequences should be used exactly once in the assembled sequence.

Dima considers two assembled sequences (p1, q1), (p2, q2), ..., (p2·n, q2·n) and (x1, y1), (x2, y2), ..., (x2·n, y2·n) distinct, if there is such i (1 ≤ i ≤ 2·n), that (pi, qi) ≠ (xi, yi).

As the answer can be rather large, print the remainder from dividing the answer by number m.

Input

The first line contains integer n (1 ≤ n ≤ 105). The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 109). The third line contains n integers b1, b2, ..., bn (1 ≤ bi ≤ 109). The numbers in the lines are separated by spaces.

The last line contains integer m (2 ≤ m ≤ 109 + 7).

Output

In the single line print the remainder after dividing the answer to the problem by number m. 

Examples

Input

1
1
2
7


Output

1


Input

2
1 2
2 3
11


Output

2

Note

In the first sample you can get only one sequence: (1, 1), (2, 1). 

In the second sample you can get such sequences : (1, 1), (2, 2), (2, 1), (3, 2); (1, 1), (2, 1), (2, 2), (3, 2). Thus, the answer is 2.
import java.util.*;

import java.math.*;
import java.io.*;

import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;

public class  test{
	
	// ArrayList<Integer> lis = new ArrayList<Integer>();
	// ArrayList<String> lis = new ArrayList<String>();
	//  PriorityQueue<P> que = new PriorityQueue<P>();
	// PriorityQueue<Integer> que = new PriorityQueue<Integer>();
	//  Stack<Integer> que = new Stack<Integer>();
    //	static long sum=0;
	// 1000000007 (10^9+7)
	static int mod = 1000000007;
	//static int mod = 1000000009,r=0;
   // static int dx[]={1,-1,0,0};
//	static int dy[]={0,0,1,-1};
//	static int dx[]={1,-1,0,0,1,1,-1,-1};
//  static int dy[]={0,0,1,-1,1,-1,1,-1};
	//static long H,L;
	//static Set<Integer> set = new HashSet<Integer>();
public  static void main(String[] args)   throws Exception, IOException{
   //String line=""; throws Exception, IOException
   //(line=br.readLine())!=null
	//Scanner sc =new Scanner(System.in);
	// !!caution!! int long //  
	Reader sc = new Reader(System.in);
  // while( ){
	  // int  n=sc.nextInt(),m=sc.nextInt();//a[]=new int[n],b[]=new int[n];
	int  n=sc.nextInt();
	PriorityQueue<P> que = new PriorityQueue<P>();
	
	 for(int i=0;i<n;i++){
        que.add(new P(sc.nextInt(),i+1 ));
	 }
	 for(int i=0;i<n;i++){
	        que.add(new P(sc.nextInt(),i+1 ));
	}
	
	 int m=sc.nextInt();
     long r=1;    
	 	while(!que.isEmpty()){
		 
	 		P p=que.poll();
	 	    int x=p.x,y=p.y,u=1,d=0; 
	 	    long f=1;
	 	  while( !que.isEmpty() && x==que.peek().x ){
	 		  u++;
	 		  P q=que.poll();
	 		  if( q.y==y ){ d++; }
	 		  else  y=q.y; 
	 	  }
	 		//db(u,d);
	 	  while( 0<u ){
	 		  int k=u;
	 		  while(0<d && (k&1)==0){ k=k>>1; d--; }
	 	      f*=k;
	 	      f%=m;		  
	 		  u--;
	 	  }
	 	 r*=f;
	 	 r%=m;
	 	 if(r==0)break;
	 }

     System.out.println(r);
}

static void db(Object... os){
    System.err.println(Arrays.deepToString(os));

}

}



class Reader
{
	private BufferedReader x;
	private StringTokenizer st;
	
	public Reader(InputStream in)
	{
		x = new BufferedReader(new InputStreamReader(in));
		st = null;
	}
	public String nextString() throws IOException
	{
		while( st==null || !st.hasMoreTokens() )
			st = new StringTokenizer(x.readLine());
		return st.nextToken();
	}
	public int nextInt() throws IOException
	{
		return Integer.parseInt(nextString());
	}
	public long nextLong() throws IOException
	{
		return Long.parseLong(nextString());
	}
	public double nextDouble() throws IOException
	{
		return Double.parseDouble(nextString());
	}
}

///*
class P implements Comparable<P>{
	int x,y;
	P(int x,int y){ this.x=x; this.y=y;  }
	
	public int compareTo(P z) {
	 if( x-z.x!=0)   return  x-z.x ;  //ascend 
	 else return  y-z.y ; 
	}
}
//*/
