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.sql.Array;
import java.util.*;

public class Contest1 {
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////                                                                                                               /////////
////////                                                                                                               /////////
////////   HHHH        HHHH  EEEEEEEEEEEEE   MMMM          MMMM         OOOOOO             SSSSSSS      EEEEEEEEEEEEE  /////////
////////   HHHH        HHHH  EEEEEEEEEEEEE   MMMMMM      MMMMMM      OOO      OOO        SSSS   SSS     EEEEEEEEEEEEE  /////////
////////   HHHH        HHHH  EEEEE           MMMM MMM  MMM MMMM    OOO          OOO    SSSS       SSS   EEEEE          /////////
////////   HHHH        HHHH  EEEEE           MMMM  MMMMMM  MMMM   OOO            OOO   SSSS             EEEEE          /////////
////////   HHHH        HHHH  EEEEE           MMMM          MMMM  OOO              OOO   SSSSSSS         EEEEE          /////////
////////   HHHHHHHHHHHHHHHH  EEEEEEEEEEE     MMMM          MMMM  OOO              OOO      SSSSSS       EEEEEEEEEEE    /////////
////////   HHHHHHHHHHHHHHHH  EEEEEEEEEEE     MMMM          MMMM  OOO              OOO         SSSSSSS   EEEEEEEEEEE    /////////
////////   HHHH        HHHH  EEEEE           MMMM          MMMM   OOO            OOO              SSSS  EEEEE          /////////
////////   HHHH        HHHH  EEEEE           MMMM          MMMM    OOO          OOO     SSS       SSSS  EEEEE          /////////
////////   HHHH        HHHH  EEEEEEEEEEEEE   MMMM          MMMM      OOO      OOO        SSS    SSSS    EEEEEEEEEEEEE  /////////
////////   HHHH        HHHH  EEEEEEEEEEEEE   MMMM          MMMM         OOOOOO             SSSSSSS      EEEEEEEEEEEEE  /////////
////////                                                                                                               /////////
////////                                                                                                               /////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    static long modPow(long a, int e, int mod)	// O(log e)
    {
        a %= mod;
        long res = 1;
        while(e > 0)
        {
            if((e & 1) == 1)
                res = (res * a) % mod;
            a = (a * a) % mod;
            e >>= 1;
        }
        return res;
    }
    static int mod=(int)998244353 ;
    static long fac[];
    static long nc(int n,int r){
        if (n<r)return 0;
        long v = fac[n];
        v*=modPow(fac[r],mod-2,mod);
        v%=mod;
        v*=modPow(fac[n-r],mod-2,mod);
        v%=mod;
        return v;
    }
    static long np(int n,int r){
        if (n<r)return 0;
        long v = fac[n];
//        v*=modPow(fac[r],mod-2,mod);
//        v%=mod;
        v*=modPow(fac[n-r],mod-2,mod);
        v%=mod;
        return v;
    }
    static long [] fib;
    static long fib(int n){
        if (fib[n]!=0)
            return fib[n];
        return fib[n]=fib(n-1)+fib(n-2);
    }
    static int getmin(TreeSet<Integer>ts , int x){
        int d=(int)2e9+100;
        Integer a = ts.floor(x);
        Integer b = ts .ceiling(x);
        if (a!=null)
            d=Math.min(d,Math.abs(x-a));
        if (b!=null)
            d=Math.min(d,Math.abs(x-b));
        return d;
    }
    static class Pair implements Comparable<Pair>{
        int a,b;
        Pair(int x,int y){
            a=x;
            b=y;
        }

        @Override
        public int compareTo(Pair pair) {
            return a!=pair.a?a-pair.a:b-pair.b;
        }
    }
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        PrintWriter pw = new PrintWriter(System.out);
        int n = sc.nextInt();
        TreeMap<Pair,Integer>count = new TreeMap<>();
        for (int i =0;i<n;i++){
            Pair z = new Pair(sc.nextInt(),i);
            count.put(z,count.getOrDefault(z,0)+1);
        }
        for (int i =0;i<n;i++){
            Pair z = new Pair(sc.nextInt(),i);
            count.put(z,count.getOrDefault(z,0)+1);
        }
        mod= sc.nextInt();
        long[][]fac= new long[n+1][20];
        int pre =-1;
        int c=1;
        int x=0;
        long ans=1;
        while (!count.isEmpty()){
            Pair z =count.firstKey();
            if (z.a==pre){
                c+=count.get(z);
            }
            else {
                pre=z.a;
                long here=1;
                int i =2;
                while (i<=c){
                    if (x>0&&i%2==0){
                        here*=(i/2);
                        here%=mod;
                        x--;
                    }
                    else here*=i;
                    here%=mod;
                    i++;
                }
                c=count.get(z);
                ans*=here;
                ans%=mod;
                x=0;
            }
            if (count.get(z)>1)x++;
            count.pollFirstEntry();
        }
        long here=1;
        int i =2;
        while (i<=c){
            if (x>0&&i%2==0){
                here*=(i/2);
                here%=mod;
                x--;
            }
            else here*=i;
            here%=mod;
            i++;
        }
        ans*=here;
        ans%=mod;
        pw.println(ans);
        pw.flush();
    }
    static void suffle(int[]a){
        for (int i =0;i<a.length;i++){
            int t = a[i];
            int idx= (int)(Math.random()*a.length);
            a[i]=a[idx];
            a[idx]=t;
        }
    }
    static long gcd(long a,long b){
        if (a==0)return b;
        return gcd(b%a,a);
    }

    static class Scanner {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(FileReader r) {
            br = new BufferedReader(r);
        }

        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        public int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        public long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        public String nextLine() throws IOException {
            return br.readLine();
        }

        public double nextDouble() throws IOException {
            String x = next();
            StringBuilder sb = new StringBuilder("0");
            double res = 0, f = 1;
            boolean dec = false, neg = false;
            int start = 0;
            if (x.charAt(0) == '-') {
                neg = true;
                start++;
            }
            for (int i = start; i < x.length(); i++)
                if (x.charAt(i) == '.') {
                    res = Long.parseLong(sb.toString());
                    sb = new StringBuilder("0");
                    dec = true;
                } else {
                    sb.append(x.charAt(i));
                    if (dec)
                        f *= 10;
                }
            res += Long.parseLong(sb.toString()) / f;
            return res * (neg ? -1 : 1);
        }

        public boolean ready() throws IOException {
            return br.ready();
        }
    }



}