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.math.*;
import static java.lang.Math.*;
import java.security.SecureRandom;
import static java.util.Arrays.*;
import java.util.*;

public class Main {

    public static void main(String[] args) throws IOException {
        new Main().run();
    }
    StreamTokenizer in;
    PrintWriter out;
//deb////////////////////////////////////////////////

    public static void deb(String n, Object n1) {
        System.out.println(n + " is : " + n1);
    }

    public static void deb(int[] A) {

        for (Object oo : A) {
            System.out.print(oo + " ");
        }
        System.out.println("");
    }
    public static void deb(boolean[] A) {

        for (Object oo : A) {
            System.out.print(oo + " ");
        }
        System.out.println("");
    }
    public static void deb(long[] A) {

        for (Object oo : A) {
            System.out.print(oo + " ");
        }
        System.out.println("");
    }

    public static void deb(String[] A) {

        for (Object oo : A) {
            System.out.print(oo + " ");
        }
        System.out.println("");
    }

    public static void deb(int[][] A) {
        for (int i = 0; i < A.length; i++) {
            for (Object oo : A[i]) {
                System.out.print(oo + " ");
            }
            System.out.println("");
        }

    }

    public static void deb(long[][] A) {
        for (int i = 0; i < A.length; i++) {
            for (Object oo : A[i]) {
                System.out.print(oo + " ");
            }
            System.out.println("");
        }

    }

    public static void deb(String[][] A) {
        for (int i = 0; i < A.length; i++) {
            for (Object oo : A[i]) {
                System.out.print(oo + " ");
            }
            System.out.println("");
        }

    }
    /////////////////////////////////////////////////////////////

    int nextInt() throws IOException {
        in.nextToken();
        return (int) in.nval;
    }

    long nextLong() throws IOException {
        in.nextToken();
        return (long) in.nval;
    }

    void run() throws IOException {
       //   in = new StreamTokenizer(new BufferedReader(new FileReader("input.txt")));
        //  out = new PrintWriter(new FileWriter("output.txt"));
          in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
        out = new PrintWriter(new OutputStreamWriter(System.out));
        solve();
        out.flush();
    }

 static long mod,ans;  
    @SuppressWarnings("unchecked")
    void solve() throws IOException  {

       BufferedReader re= new BufferedReader(new InputStreamReader(System.in));
int n=nextInt();
ans=1;
   long[] A= new long[2*n];
        for (int i = 1; i <= n; i++) {
            A[i-1]=nextLong()*1000000L+(long)i;
        }
        for (int i = 1; i <= n; i++) {
            A[n+i-1]=nextLong()*1000000L+(long)i;
        }
         mod=nextLong();
         
  sort(A);
    //   deb(A);
      long count=1;
      int n22=0;
     
     
        for (int i = 1; i < 2*n; i++) {
            if(A[i-1]/1000000L!=A[i]/1000000L){
          runs(count,n22);
          count=1;
          n22=0;
         
            }
            else{
            count++;
           if(A[i]==A[i-1])n22++;
           }
        }
        
      runs(count,n22);
        System.out.println(ans);
    }

    private void runs(long count, int n22) {
    //    System.out.println(count+"  "+n22);
      int t=n22;
      long ret=1;
        for (long i = count; i >1; i--) {
           if(t>0){
            long tmp=i;
            while(tmp%2==0&&t>0){
            tmp/=2;t--;
            }
           ret*=tmp;
           if(ret>mod)ret%=mod;
           }
           else
           {ret*=i;
           if(ret>mod)ret%=mod;
           
           }
        }
        ans*=ret;
        if(ans>=mod)ans%=mod;
      //  System.out.println(ans);
    }


}
 
//////////////////////////

