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-2017 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: May/28/2017 15:22:23 (c2).

Desktop version, switch to mobile version.
User lists

Name |
---|