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.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.FilterInputStream;
import java.io.BufferedInputStream;
import java.util.HashMap;
import java.util.Collections;
import java.util.ArrayList;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author khokharnikunj8
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        ScanReader in = new ScanReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Ddimaandtwosequences solver = new Ddimaandtwosequences();
        solver.solve(1, in, out);
        out.close();
    }

    static class Ddimaandtwosequences {
        int mod;

        public void solve(int testNumber, ScanReader in, PrintWriter out) {
            int n = in.scanInt();
            int[][] ar = new int[2 * n][2];
            HashMap<Integer, ArrayList<Integer>> map = new HashMap<>();
            for (int i = 0; i < 2 * n; i++) {
                ar[i][0] = in.scanInt();
                ar[i][1] = i % n;
                if (!map.containsKey(ar[i][0])) map.put(ar[i][0], new ArrayList<>());
                map.get(ar[i][0]).add(ar[i][1]);
            }
            mod = in.scanInt();
            long[] fact = new long[2 * n + 5];
            fact[0] = 1;
            for (int i = 1; i <= 2 * n; i++) fact[i] = (fact[i - 1] * (i)) % mod;
            long ans = 1;
            int[] how = new int[2 * n + 1];
            int count = 0;
            for (int key : map.keySet()) {
                ArrayList<Integer> tt = map.get(key);
                Collections.sort(tt);
                how[tt.size()]++;
                for (int i = 0; i < tt.size() - 1; i++) {
                    if (tt.get(i).intValue() == tt.get(i + 1).intValue()) count++;

                }
            }
            int counter = 0;
            for (int i = 2 * n; i >= 1; i--) {
                counter += how[i];
                int tempo = counter;
                if (i % 2 == 0) {
                    while (tempo > 0) {
                        if (count == 0) {
                            ans = (ans * CodeHash.pow(i, tempo, mod)) % mod;
                            tempo = 0;
                        } else {
                            long temp_i = i;
                            while (temp_i % 2 == 0 && count > 0) {
                                temp_i /= 2;
                                count--;
                            }
                            ans = (ans * temp_i) % mod;
                        }
                        tempo--;
                    }
                } else {
                    ans = (ans * CodeHash.pow(i, counter, mod)) % mod;
                }
            }
            if (count != 0) throw new RuntimeException("NO");
            out.println(ans % mod);


        }

    }

    static class ScanReader {
        private byte[] buf = new byte[4 * 1024];
        private int index;
        private BufferedInputStream in;
        private int total;

        public ScanReader(InputStream inputStream) {
            in = new BufferedInputStream(inputStream);
        }

        private int scan() {
            if (index >= total) {
                index = 0;
                try {
                    total = in.read(buf);
                } catch (Exception e) {
                    e.printStackTrace();
                }
                if (total <= 0) return -1;
            }
            return buf[index++];
        }

        public int scanInt() {
            int integer = 0;
            int n = scan();
            while (isWhiteSpace(n)) n = scan();
            int neg = 1;
            if (n == '-') {
                neg = -1;
                n = scan();
            }
            while (!isWhiteSpace(n)) {
                if (n >= '0' && n <= '9') {
                    integer *= 10;
                    integer += n - '0';
                    n = scan();
                }
            }
            return neg * integer;
        }

        private boolean isWhiteSpace(int n) {
            if (n == ' ' || n == '\n' || n == '\r' || n == '\t' || n == -1) return true;
            else return false;
        }

    }

    static class CodeHash {
        public static long pow(long a, long b, long m) {
            long res = 1;
            a %= m;
            while (b > 0) {
                if ((b & 1) == 1) res = (res * a) % m;
                a = (a * a) % m;
                b >>= 1;
            }
            return res;
        }

    }
}

