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.io.*;
import java.util.*;
public final class dima_and_seq
{
    static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
	static FastScanner sc=new FastScanner(br);
    static PrintWriter out=new PrintWriter(System.out);
	static Random rnd=new Random();
	static int[] a,b,c,arr,sp;
	static Map<Integer,Integer> m1,m2,m3;
	static long[] fact,inv_fact;
	static long mod;
	static int maxn=(int)(2e5+3);
	static ArrayList<Integer>[] al,div;
	
	static long pow(long a,long b)
	{
		long x=1,y=a%mod;
		while(b>0)
		{
			if(b%2==1)
			{
				x=(x*y)%mod;
			}
			y=(y*y)%mod;b=b/2;
		}
		return x;
	}
	
	static long get(int x,List<Integer> list)
	{
		m2=new HashMap<>();m3=new HashMap<>();
		for(int i=2;i<=x;i++)
		{
			for(int y:div[i])
			{
				put(m2,y,1);
			}
		}
		for(int y:list)
		{
			for(int i=2;i<=y;i++)
			{
				for(int z:div[i])
				{
					put(m3,z,1);
				}
			}
		}
		long ret=1;
		for(Map.Entry<Integer,Integer> en:m2.entrySet())
		{
			int key=en.getKey(),val=en.getValue();
			if(m3.get(key)!=null)
			{
				val-=m3.get(key);
			}
			ret=(ret*pow(key,val))%mod;
		}
		return ret;
	}
	
	static void mark(int num)
	{
		int i=1,elem;
		while((elem=(num*i))<maxn)
		{
			arr[elem]=1;sp[elem]=num;i++;
		}
	}
	
	@SuppressWarnings("unchecked")
	static void build()
	{
		arr=new int[maxn];sp=new int[maxn];div=new ArrayList[maxn];
		for(int i=2;i<maxn;i++)
		{
			div[i]=new ArrayList<Integer>();
		}
		for(int i=2;i<maxn;i++)
		{
			if(arr[i]==0)
			{
				mark(i);
			}
		}
		for(int i=2;i<maxn;i++)
		{
			int curr=i;
			while(curr>1)
			{
				div[i].add(sp[curr]);curr/=sp[curr];
			}
		}
	}
	
	static void put(Map<Integer,Integer> m1,int idx,int val)
	{
		if(m1.get(idx)==null)	
		{
			m1.put(idx,val);return;
		}
		m1.put(idx,m1.get(idx)+val);
	}
	
	@SuppressWarnings("unchecked")
    public static void main(String args[]) throws Exception
    {
		build();int n=sc.nextInt(),j=0;a=new int[n];b=new int[n];c=new int[n+n];
		for(int i=0;i<n;i++)
		{
			a[i]=sc.nextInt();c[j++]=a[i];
		}
		for(int i=0;i<n;i++)
		{
			b[i]=sc.nextInt();c[j++]=b[i];
		}
		Arrays.sort(c);mod=sc.nextLong();
		for(int i=0;i<n;i++)
		{
			a[i]=Arrays.binarySearch(c,a[i]);
			b[i]=Arrays.binarySearch(c,b[i]);
		}
		al=new ArrayList[maxn];long res=1;
		for(int i=0;i<maxn;i++)
		{
			al[i]=new ArrayList<Integer>();
		}
		for(int i=0;i<n;i++)
		{
			al[a[i]].add(i);
			al[b[i]].add(i);
		}
		for(int i=0;i<maxn;i++)
		{
			if(al[i].size()>0)
			{
				m1=new HashMap<>();
				for(int x:al[i])
				{
					put(m1,x,1);
				}
				List<Integer> list=new ArrayList<>();
				for(Map.Entry<Integer,Integer> en:m1.entrySet())
				{
					list.add(en.getValue());
				}
				long now=get(al[i].size(),list);res=(res*now)%mod;
			}
		}
		out.println(res);out.close();
    }
}
class FastScanner
{
    BufferedReader in;
    StringTokenizer st;

    public FastScanner(BufferedReader in) {
        this.in = in;
    }
	
    public String nextToken() throws Exception {
        while (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(in.readLine());
        }
        return st.nextToken();
    }
	
	public String next() throws Exception {
		return nextToken().toString();
	}
	
    public int nextInt() throws Exception {
        return Integer.parseInt(nextToken());
    }

    public long nextLong() throws Exception {
        return Long.parseLong(nextToken());
    }

    public double nextDouble() throws Exception {
        return Double.parseDouble(nextToken());
    }
}