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.
/**
 * @author derrick20
 */
import java.io.*;
import java.util.*;

public class DimaTwo {
    public static void main(String[] args) throws Exception {
        FastScanner sc = new FastScanner();
        PrintWriter out = new PrintWriter(System.out);

        int N = sc.nextInt();
        var freq = new HashMap<Integer, Integer>();
        int[] a = sc.nextInts(N);
        int[] b = sc.nextInts(N);
        int dup = 0;
        for (int i = 0; i < N; i++) {
            freq.merge(a[i], 1, Integer::sum);
            freq.merge(b[i], 1, Integer::sum);
            if (a[i] == b[i]) {
                dup++;
            }
        }
        mod = sc.nextLong();

        long[] prefix = new long[2 * N + 2];
        for (int group : freq.values()) {
            prefix[1]++;
            prefix[group + 1]--;
        }

        int lastPos = 1;
        for (int i = 1; i <= 2 * N; i++) {
            prefix[i] += prefix[i - 1];
            if (prefix[i] > 0) {
                lastPos = i;
            }
        }

        int k = 1;
        while ((1 << (k + 1)) <= lastPos) {
            k++;
        }
//        System.out.println(Arrays.toString(prefix));
//        while (dup > 0) {
//            int pow = 1 << k;
//            for (int x = pow; x <= lastPos; x += pow) {
//                if (prefix[x] * k >= dup) {
//                    // lose as much as is feasible
//                    prefix[x] -= dup / k;
//                    dup -= (dup / k) * k; // rounded, take as much as possible
//                    break;
//                }
//                else {
//                    // lose all of it
//                    dup -= prefix[x] * k;
//                    prefix[x] = 0;
//                }
//            }
//            k--;
//        }
//        System.out.println(Arrays.toString(prefix));
        long ans = 1;
        for (int i = 2; i <= lastPos; i++) {
            if (prefix[i] > 0) {
                for (int j = 0; j < prefix[i]; j++) {
                    int x = i;
                    while (x % 2 == 0 && dup > 0) {
                        // this activates at most 10^5 times
                        dup--;
                        x /= 2;
                    }
                    ans = (ans * x) % mod;
                }
            }
        }
        // divde out a 2, for every position with a duplicate
        out.println(ans);
        out.close();
    }

    static long mod;

    static long fastExpo(long x, long k) {
        if (k == 0) {
            return 1;
        }
        else if (k == 1) {
            return x;
        }
        else {
            long root = fastExpo(x, k / 2);
            long ans = (root * root) % mod;
            if (k % 2 == 1) {
                ans = (ans * x) % mod;
            }
            return ans;
        }
    }

    static class FastScanner {
        private int BS = 1<<16;
        private char NC = (char)0;
        private byte[] buf = new byte[BS];
        private int bId = 0, size = 0;
        private char c = NC;
        private double cnt = 1;
        private BufferedInputStream in;

        public FastScanner() {
            in = new BufferedInputStream(System.in, BS);
        }

        public FastScanner(String s) {
            try {
                in = new BufferedInputStream(new FileInputStream(new File(s)), BS);
            }
            catch (Exception e) {
                in = new BufferedInputStream(System.in, BS);
            }
        }

        private char getChar(){
            while(bId==size) {
                try {
                    size = in.read(buf);
                }catch(Exception e) {
                    return NC;
                }
                if(size==-1)return NC;
                bId=0;
            }
            return (char)buf[bId++];
        }

        public int nextInt() {
            return (int)nextLong();
        }

        public int[] nextInts(int N) {
            int[] res = new int[N];
            for (int i = 0; i < N; i++) {
                res[i] = (int) nextLong();
            }
            return res;
        }

        public long[] nextLongs(int N) {
            long[] res = new long[N];
            for (int i = 0; i < N; i++) {
                res[i] = nextLong();
            }
            return res;
        }

        public long nextLong() {
            cnt=1;
            boolean neg = false;
            if(c==NC)c=getChar();
            for(;(c<'0' || c>'9'); c = getChar()) {
                if(c=='-')neg=true;
            }
            long res = 0;
            for(; c>='0' && c <='9'; c=getChar()) {
                res = (res<<3)+(res<<1)+c-'0';
                cnt*=10;
            }
            return neg?-res:res;
        }

        public double nextDouble() {
            double cur = nextLong();
            return c!='.' ? cur:cur+nextLong()/cnt;
        }

        public String next() {
            StringBuilder res = new StringBuilder();
            while(c<=32)c=getChar();
            while(c>32) {
                res.append(c);
                c=getChar();
            }
            return res.toString();
        }

        public String nextLine() {
            StringBuilder res = new StringBuilder();
            while(c<=32)c=getChar();
            while(c!='\n') {
                res.append(c);
                c=getChar();
            }
            return res.toString();
        }

        public boolean hasNext() {
            if(c>32)return true;
            while(true) {
                c=getChar();
                if(c==NC)return false;
                else if(c>32)return true;
            }
        }
    }
}