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.util.*;
import java.lang.*;
import java.io.*;

// Created by @thesupremeone on 19/05/21
public class DimaAndTwoSequences {
    static class Point implements Comparable<Point>{
        int x, y;
        public Point(int x, int y) {
            this.x = x;
            this.y = y;
        }
        @Override
        public int hashCode() {
            String s = x+":"+y;
            return s.hashCode();
        }
        @Override
        public int compareTo(Point point) {
            if(x!=point.x)
                return Integer.compare(x, point.x);
            return Integer.compare(y, point.y);
        }
    }
    long fact(long n, long m, int power){
        long ans = 1;
        for (int i = 1; i <= n; i++) {
            ans *= i;
            while (power>0 && ans%2==0){
                ans/=2;
                power--;
            }
            ans%=m;
        }
        return ans;
    }

    void solve() throws IOException {
        int n = getInt();
        ArrayList<Point> points = new ArrayList<>();
        for (int i = 0; i < 2*n; i++) {
            points.add(new Point(getInt(), i<n ? i+1 : i+1-n));
        }
        long m = getInt();
        Collections.sort(points);
        long ans = 1;
        int count = 0;
        int lastX = -1;
        HashMap<Integer, Integer> map = new HashMap<>();
        for (int i = 0; i <= points.size(); i++) {
            Point point = i<points.size() ? points.get(i) : null;
            if(i==points.size() || (i!=0 && lastX!=point.x)){
                int power = 0;
                for(int key : map.keySet()){
                    if(map.get(key)==2) power++;
                }
                long smallAns = fact(count, m, power);
                ans = (ans*smallAns)%m;
                if(i==points.size()) break;
                map.clear();
                count = 0;
            }
            int f = map.getOrDefault(point.y, 0);
            map.put(point.y, f+1);
            lastX = point.x;
            count++;
        }
        println(ans);
    }

    public static void main(String[] args) throws Exception {
        if (isOnlineJudge()) {
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new BufferedWriter(new OutputStreamWriter(System.out));
            new DimaAndTwoSequences().solve();
            out.flush();
        } else {
            localJudge = new Thread();
            in = new BufferedReader(new FileReader("input.txt"));
            out = new BufferedWriter(new FileWriter("output.txt"));
            localJudge.start();
            new DimaAndTwoSequences().solve();
            out.flush();
            localJudge.suspend();
        }
    }
    static boolean isOnlineJudge(){
        try {
            return System.getProperty("ONLINE_JUDGE")!=null
                    || System.getProperty("LOCAL")==null;
        }catch (Exception e){
            return true;
        }
    }
    // Fast Input & Output
    static Thread localJudge = null;
    static BufferedReader in;
    static StringTokenizer st;
    static BufferedWriter out;
    static String getLine() throws IOException{
        return in.readLine();
    }
    static String getToken() throws IOException{
        if(st==null || !st.hasMoreTokens())
            st = new StringTokenizer(getLine());
        return st.nextToken();
    }
    static int getInt() throws IOException {
        return Integer.parseInt(getToken());
    }
    static long getLong() throws IOException {
        return Long.parseLong(getToken());
    }
    static void print(Object s) throws IOException{
        out.write(String.valueOf(s));
    }
    static void println(Object s) throws IOException{
        out.write(String.valueOf(s));
        out.newLine();
    }
}