Codeforces celebrates 10 years! We are pleased to announce the crowdfunding-campaign. Congratulate us by the link https://codeforces.com/10years.
×

Package for this problem was not updated by the problem writer or Codeforces administration after we’ve upgraded the judging servers. To adjust the time limit constraint, solution execution time will be multiplied by 2. For example, if your solution works for 400 ms on judging servers, then value 800 ms will be displayed and used to determine the verdict.

Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

No tag edit access

D. Dima and Two Sequences

time limit per test

2 secondsmemory limit per test

256 megabytesinput

standard inputoutput

standard outputLittle Dima has two sequences of points with integer coordinates: sequence (*a*_{1}, 1), (*a*_{2}, 2), ..., (*a*_{n}, *n*) and sequence (*b*_{1}, 1), (*b*_{2}, 2), ..., (*b*_{n}, *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 (*p*_{1}, *q*_{1}), (*p*_{2}, *q*_{2}), ..., (*p*_{2·n}, *q*_{2·n}) and (*x*_{1}, *y*_{1}), (*x*_{2}, *y*_{2}), ..., (*x*_{2·n}, *y*_{2·n}) distinct, if there is such *i* (1 ≤ *i* ≤ 2·*n*), that (*p*_{i}, *q*_{i}) ≠ (*x*_{i}, *y*_{i}).

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* ≤ 10^{5}). The second line contains *n* integers *a*_{1}, *a*_{2}, ..., *a*_{n} (1 ≤ *a*_{i} ≤ 10^{9}). The third line contains *n* integers *b*_{1}, *b*_{2}, ..., *b*_{n} (1 ≤ *b*_{i} ≤ 10^{9}). The numbers in the lines are separated by spaces.

The last line contains integer *m* (2 ≤ *m* ≤ 10^{9} + 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.

Codeforces (c) Copyright 2010-2020 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Feb/24/2020 07:58:18 (f1).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|