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.util.*;

public class Solution {

    private static PrintWriter out;

    public static void main(String[] args) throws Exception {
        out = new PrintWriter(System.out);
        new Solution().solve();
        out.close();
    }

    private BufferedReader reader;
    private StringTokenizer st;
    private int n, m;

    private long[] pows, sumOfPows, fact;
    private int[] powOfTwo, withoutTwo;
    private Pair[] data;

    private void solve() throws Exception {

        reader = new BufferedReader(new InputStreamReader(System.in));

        n = Integer.parseInt(reader.readLine());
        pows = new long[2 * n + 1];
        powOfTwo = new int[2 * n + 1];
        sumOfPows = new long[2 * n + 1];
        fact = new long[2 * n + 1];
        withoutTwo = new int[2 * n + 1];
        data = new Pair[2 * n];

        st = new StringTokenizer(reader.readLine());
        for (int i = 0; i < n; ++i) {
            data[i] = new Pair(Integer.parseInt(st.nextToken()), i);
        }

        st = new StringTokenizer(reader.readLine());
        for (int i = 0; i < n; ++i) {
            data[n + i] = new Pair(Integer.parseInt(st.nextToken()), i);
        }

        m = Integer.parseInt(reader.readLine());

        reader.close();

        pows[0] = fact[0] = 1L;
        sumOfPows[0] = 0L;
        powOfTwo[0] = 0;
        withoutTwo[0] = 0;
        for (int i = 1; i <= 2 * n; ++i) {

            if (i % 2 == 0) {
                withoutTwo[i] = withoutTwo[i / 2];
            } else {
                withoutTwo[i] = i;
            }

            pows[i] = (2 * pows[i - 1]) % m;
            fact[i] = (withoutTwo[i] * fact[i - 1]) % m;

            if (i % 2 == 0) {
                powOfTwo[i] = powOfTwo[i / 2] + 1;
            } else {
                powOfTwo[i] = 0;
            }

            sumOfPows[i] = (sumOfPows[i - 1] + powOfTwo[i]) % m;
        }

        Arrays.sort(data);

        int twoPow = 0;
        for (int i = 1; i < 2 * n; ++i) {
            if (data[i].x == data[i - 1].x && data[i].y == data[i - 1].y) {
                twoPow++;
            }
        }

        int cnt1 = 1;
        int cnt2 = 0;
        long ans = 1L;

        for (int i = 1; i < 2 * n; ++i) {
            if (data[i].x != data[i  - 1].x) {
                cnt2 += sumOfPows[cnt1];

                ans = (ans * fact[cnt1]) % m;
                cnt1 = 1;
            } else {
                cnt1++;
            }
        }

        if (cnt1 > 1) {
            cnt2 += sumOfPows[cnt1];
            ans = (ans * fact[cnt1]) % m;
        }

        cnt2 -= twoPow;
        ans = (ans * pows[cnt2]) % m;
        out.println(ans);
    }

    private class Pair implements Comparable<Pair> {

        public int x, y;
        public Pair(int x, int y) {
            this.x = x;
            this.y = y;
        }

        @Override
        public int compareTo(Pair p) {

            if (x != p.x) {
                return x - p.x;
            }

            return y - p.y;
        }
    }
}