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.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.HashSet;
public class D272 
{
    static class Scanner
    {
        BufferedReader br;
        StringTokenizer tk=new StringTokenizer("");
        public Scanner(InputStream is) 
        {
            br=new BufferedReader(new InputStreamReader(is));
        }
        public int nextInt() throws IOException
        {
            if(tk.hasMoreTokens())
                return Integer.parseInt(tk.nextToken());
            tk=new StringTokenizer(br.readLine());
            return nextInt();
        }
        public long nextLong() throws IOException
        {
            if(tk.hasMoreTokens())
                return Long.parseLong(tk.nextToken());
            tk=new StringTokenizer(br.readLine());
            return nextLong();
        }
        public String next() throws IOException
        {
            if(tk.hasMoreTokens())
                return (tk.nextToken());
            tk=new StringTokenizer(br.readLine());
            return next();
        }
        public String nextLine() throws IOException
        {
            tk=new StringTokenizer("");
            return br.readLine();
        }
        public double nextDouble() throws IOException
        {
            if(tk.hasMoreTokens())
                return Double.parseDouble(tk.nextToken());
            tk=new StringTokenizer(br.readLine());
            return nextDouble();
        }
        public char nextChar() throws IOException
        {
            if(tk.hasMoreTokens())
                return (tk.nextToken().charAt(0));
            tk=new StringTokenizer(br.readLine());
            return nextChar();
        }
        public int[] nextIntArray(int n) throws IOException
        {
            int a[]=new int[n];
            for(int i=0;i<n;i++)
                a[i]=nextInt();
            return a;
        }
        public long[] nextLongArray(int n) throws IOException
        {
            long a[]=new long[n];
            for(int i=0;i<n;i++)
                a[i]=nextLong();
            return a;
        }
        public int[] nextIntArrayOneBased(int n) throws IOException
        {
            int a[]=new int[n+1];
            for(int i=1;i<=n;i++)
                a[i]=nextInt();
            return a;
        }
        public long[] nextLongArrayOneBased(int n) throws IOException
        {
            long a[]=new long[n+1];
            for(int i=1;i<=n;i++)
                a[i]=nextLong();
            return a;
        }
    
    
    }
    
    public static void main(String args[]) throws IOException
    {
        Scanner in=new Scanner(System.in);
        PrintWriter out=new PrintWriter(System.out);
        int n=in.nextInt();
        int freq[]=new int[200005];
        HashMap<Integer,HashMap<Integer,Integer>> mp=new HashMap<>();
        for(int i=1;i<=n;i++)
        {
            int x=in.nextInt();
            if(!mp.containsKey(x))
                mp.put(x,new HashMap<>());
            int v=1+mp.get(x).getOrDefault(i, 0);
            mp.get(x).put(i, v);
        }
        for(int i=1;i<=n;i++)
        {
            int x=in.nextInt();
            if(!mp.containsKey(x))
                mp.put(x,new HashMap<>());
            int v=1+mp.get(x).getOrDefault(i, 0);
            mp.get(x).put(i, v);
        }
        for(HashMap<Integer,Integer> m:mp.values())
        {
            int su=0;
            for(int v:m.values())
            {
                su+=v;
                freq[1]--;
                freq[v+1]++;
            }
            freq[1]++;
            freq[su+1]--;
        }
        long mod=in.nextLong();
        int p[]=new int[200005];
        p[1]=1;
        for(int i=2;i<=200000;i++)
            if(p[i]==0)
            {
                for(int j=i;j<=200000;j+=i)
                    if(p[j]==0)
                        p[j]=i;
            }
        int frew[]=new int[200005];
        for(int i=1;i<freq.length;i++)
        {
            freq[i]+=freq[i-1];
            n=i;
            if(freq[i]==0)
                continue;
            while(n>1)
            {
                int pf=p[n];
                int cnt=0;
                while(n%pf==0)
                {
                    cnt++;
                    n/=pf;
                }
                frew[pf]+=cnt*freq[i];
            }
        }
        long ans=1;
        for(int i=2;i<=200000;i++)
        {
            if(frew[i]==0)
                continue;
            ans=(ans*pow(i,frew[i],mod))%mod;
        }
        out.println(ans);
        out.close();
    }
    static long pow(long b,long e,long m)
    {
        long res=1;
        while(e>0)
        {
            if(e%2==1)
            {
                res=(res*b)%m;
            }
            e/=2;
            b*=b;
            b%=m;
        }
        return res;
    }
}
