One summer Jack had "working practice" in the school library: he was fixing old textbooks, helping the librarians with sorting books, etc. Jack always sticks his snout into everything, and math textbooks were no exception.
In one of the books he saw the following:
… denoted as D(M) — a skew-symmetric polylinear normed function of square matrix columns, i.e.:
1. If two columns of the matrix are swapped, its value changes sign:

2. If a matrix column is a linear combination of two vectors, the linear combination can be taken out:

3. On the identity matrix it equals 1:

Let us prove that such a function is unique:
… (Jack skips pages and reads in small bits) …
… for example, using Gaussian elimination.
… (very small bits) …
… the matrix X is the product of the column u and the row v, i.e.:

Jack is very intrigued by what he’s just read. Jack enjoys competitive programming and spends all his time on the Codeforces website, so he’s not at all afraid of matrices and vectors. But his math could use some improvement.
Jack wants to calculate the value of the mentioned skew-symmetric polylinear normed function D for the matrix X defined in the last bit of text. To make things easier, all elements of the vectors u and v are integers. He has a hunch that the answer is an integer too. Since he thinks it can be very, very big, Jack wants to find it modulo the prime number P (that’s how things are usually done).
Help Jack solve the task. Otherwise, the aforementioned website will be spammed.
The first line contains two integers and (1 \leq N \leq 100, 2 \leq P \leq 2 \cdot 10^9). It is guaranteed that is a prime number. The second line contains integers u_1, u_2, \ldots, u_n — elements of the column vector . The third line contains integers v_1, v_2, \ldots, v_n — elements of the row vector (0 \leq u_i, v_j < P).
Print a single integer: the value of modulo . The number must be non-negative and strictly less than .
1-nji mysal