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.DataInputStream;
import java.io.InputStream;
import java.util.Arrays;

public class Main {

    static class Point implements Comparable<Point> {
        int x;
        int y;

        public Point(int a, int b) {
            x = a;
            y = b;
        }

        @Override
        public int compareTo(Point f) {
            if (x < f.x)
                return -1;
            if (x > f.x)
                return 1;
            if (y < f.y)
                return -1;
            return 1;
        }
        @Override
        public String toString() {
            return "("+x+","+y+")";
        }
    }

    public static void main(String[] args) throws Exception {
        Parserdoubt3 s = new Parserdoubt3(System.in);

        int n = s.nextInt();
        int a[] = new int[n];
        int b[] = new int[n];

        Point p[] = new Point[2 * n + 2];

        for (int i = 0; i < a.length; i++) {
            int x = s.nextInt();
            p[i] = new Point(x, i);
        }
        for (int i = 0; i < b.length; i++) {
            int x = s.nextInt();
            p[i + n] = new Point(x, i);
        }
        p[2 * n] = new Point(-1, -1);
        p[2 * n + 1] = new Point(Integer.MAX_VALUE, Integer.MAX_VALUE);
        long m = s.nextInt();

        Arrays.sort(p);

        
        long ans = 1;
//      System.out.println(Arrays.toString(p));
        for (int i = 1; i < p.length - 1; ) {
            int j = i;
            while(p[j].x == p[i].x){
                j++;
            }
            // from i to j ednakvi se x
            
            int N = j - i;
            
            int count2 = 0;
            
            int k = i;
            for (; k < j; ) {
                int from = k;
                int to = k;
                while(p[to].x == p[from].x && p[to].y == p[from].y) {
                    to++;
                }
                
                int K1 = to - from;
                if(K1 == 2)
                    count2++;
                
                k = to;
            }
            
//          System.out.println("Count2: "+count2+"  N "+N);
            long partial = 1;
            while(N > 0){
                if((N&1) == 0){
                    if(count2 > 0){
                        partial *= N/2;
                        count2--;
                    }
                    else {
                        partial *= N;
                    }
                }
                else {
                    partial *= N;
                }
                partial %= m;
                N--;
            }
//          System.out.println("Count2: "+count2+"  N "+N);
//          System.out.println(i+" " + (j-1) + " " +partial);
            ans *= partial;
            ans %= m;
            
            i = j;
        }
        
        System.out.println(ans);
    }

    static long modInverse(long a, long n) {
        long i = n, v = 0, d = 1;
        while (a > 0) {
            long t = i / a, x = a;
            a = i % x;
            i = x;
            x = d;
            d = v - t * x;
            v = x;
        }
        v %= n;
        if (v < 0)
            v = (v + n) % n;
        return v;
    }

}

class Parserdoubt3 {
    final private int BUFFER_SIZE = 1 << 17;

    private DataInputStream din;
    private byte[] buffer;
    private int bufferPointer, bytesRead;

    public Parserdoubt3(InputStream in) {
        din = new DataInputStream(in);
        buffer = new byte[BUFFER_SIZE];
        bufferPointer = bytesRead = 0;
    }

    public String nextString() throws Exception {
        StringBuffer sb = new StringBuffer("");
        byte c = read();
        while (c <= ' ')
            c = read();
        do {
            sb.append((char) c);
            c = read();
        } while (c > ' ');
        return sb.toString();
    }

    public char nextChar() throws Exception {
        byte c = read();
        while (c <= ' ')
            c = read();
        return (char) c;
    }

    public int nextInt() throws Exception {
        int ret = 0;
        byte c = read();
        while (c <= ' ')
            c = read();
        boolean neg = c == '-';
        if (neg)
            c = read();
        do {
            ret = ret * 10 + c - '0';
            c = read();
        } while (c > ' ');
        if (neg)
            return -ret;
        return ret;
    }

    public long nextLong() throws Exception {
        long ret = 0;
        byte c = read();
        while (c <= ' ')
            c = read();
        boolean neg = c == '-';
        if (neg)
            c = read();
        do {
            ret = ret * 10 + c - '0';
            c = read();
        } while (c > ' ');
        if (neg)
            return -ret;
        return ret;
    }

    private void fillBuffer() throws Exception {
        bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
        if (bytesRead == -1)
            buffer[0] = -1;
    }

    private byte read() throws Exception {
        if (bufferPointer == bytesRead)
            fillBuffer();
        return buffer[bufferPointer++];
    }
}