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 org.omg.CORBA.MARSHAL;

import javax.sound.sampled.Line;
import java.io.*;
import java.math.BigDecimal;
import java.nio.Buffer;
import java.util.*;
import java.util.concurrent.atomic.AtomicReferenceArray;

public class codeforces
{


   // public static long fact[];
   // public static int mod=1000000007;
    public static long []st;
    public static int k;
    public static int[][] grid;
    public static boolean[][] visit;
    public static long n;
    public static long b;
    public static int move=0;
    public static long MOD;

    public static long badCount=0;
    public static void main(String[] args) throws IOException {

        InputReader in=new InputReader(System.in);
        PrintWriter out=new PrintWriter(System.out);


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


            for (int i = 0; i < n; i++)
                a[i] = in.nextInt();
            for (int i = 0; i < n; i++) {
                b[i] = in.nextInt();
                if (b[i] == a[i])
                    badCount++;
            }

             HashMap<Integer,Integer> map=new HashMap<>();
            for(int i=0;i<n;i++)
            {
                int k = a[i];
                Integer cur=map.get(k);
                if(cur==null)
                {
                    map.put(k,1);
                }else
                {
                    map.put(k,cur+1);
                }
            }
            for(int i=0;i<n;i++)
            {
                int k=b[i];
                Integer cur=map.get(k);
                if(cur==null)
                {
                    map.put(k,1);
                }else
                {
                    map.put(k,cur+1);
                }
            }
            MOD = in.nextInt();

            long ans = 1;
            for (Map.Entry<Integer, Integer> entry : map.entrySet()) {
                ans = (ans * f(entry.getValue())) % MOD;
            }
            if (badCount > 0)
                ans = 0;
            out.print(ans);
       out.close();

    }
   public static long f(long n) {
        long res = 1;
        for (int i = 2; i <= n; i++) {
            int k = i;
            while (k % 2 == 0 && badCount > 0) {
                badCount--;
                k /= 2;
            }
            res = (res * k) % MOD;

        }
        return res;
    }

    public static int bs(int []search,int target)
    {
        int low=0;
        int high=search.length-1;
        int ans=0;
        while (low<=high) {
            int mid = (low + high) >> 1;
            if (search[mid] <= target) {
                ans = mid;
                low = mid + 1;
            } else {
                high = mid - 1;
            }
        }
        return ans;

    }

   public static long ts(long start, long end)
    {
        long l = start, r = end;

        for(int i=0; i<200; i++) {
            long l1 = (l*2+r)/3;
            long l2 = (l+2*r)/3;

            if(fc(l1) > fc(l2))
                r = l2;
            else
                l = l1;
        }

       long x=l;

        return x;
    }
    public static long fc(long x) {

        return x*(n-x*b);
    }

    public static int bfs(int i,int j,int n,int m)
    {
        int troop=0;
        Queue<node> qq=new LinkedList<>();
        qq.add(new node(i,j));
        while (!qq.isEmpty())
        {
            node cur=qq.poll();
            troop++;
            for (int r=-1;r<=1;r++)
            {
                for (int c=-1;c<=1;c++)
                {
                    if(cur.x+r>=0 && cur.x+r<n && cur.y+c>=0 && cur.y+c<m)
                    {
                        if(!visit[cur.x+r][cur.y+c])
                        {
                            visit[cur.x+r][cur.y+c]=true;
                            if(grid[cur.x+r][cur.y+c]==1)
                            {
                                qq.add(new node(cur.x+r,cur.y+c));
                            }

                        }
                    }

                }
            }
        }
        return troop;


    }

    static class node{

        int x;
        int y;

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




    public static int nextPowerOf2(final int a) {
        int b = 1;
        while (b < a) {
            b = b << 1;
        }
        return b;
    }

    public static long []contruct(long []a)

    {
        int next2power=nextPowerOf2(a.length);
        st=new long[next2power*2-1];
        //System.out.println(size);
        // st=new long[size];
        Arrays.fill(st,Integer.MAX_VALUE);
        constructST(a,0,a.length-1,0);
        return st;



    }
    public static void constructST(long []a,int start,int end,int pos)
    {
        if(start==end)
        {
            st[pos]=a[start];
            return ;
        }
        int mid=(start+end)>>1;
        constructST(a,start,mid,pos*2+1);
        constructST(a,mid+1,end,pos*2+2);
        st[pos]=st[2*pos+1]^st[2*pos+2];


    }

       static class InputReader {

        private InputStream stream;
        private byte[] buf = new byte[8192];
        private int curChar, snumChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int snext() {
            if (snumChars == -1)
                throw new InputMismatchException();
            if (curChar >= snumChars) {
                curChar = 0;
                try {
                    snumChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (snumChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = snext();
            while (isSpaceChar(c))
                c = snext();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = snext();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = snext();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public long nextLong() {
            int c = snext();
            while (isSpaceChar(c))
                c = snext();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = snext();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = snext();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public int[] nextIntArray(int n) {
            int a[] = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        public String readString() {
            int c = snext();
            while (isSpaceChar(c))
                c = snext();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = snext();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);
        }
    }
}