#include <bits/stdc++.h>
using namespace std;
const int maxn = 100010;
int n, z[2][maxn], m, fac[maxn << 1], er[maxn << 1];
struct rec {
  int v, belong, id;
  rec() {}
  rec(int a, int b, int c) {
    v = a;
    belong = b;
    id = c;
  }
} y[maxn << 1];
bool cmp(rec a, rec b) { return a.v < b.v; }
int mul(int a, int b) {
  int ans = 1;
  while (b) {
    if (b & 1) ans = (long long)ans * a % m;
    a = (long long)a * a % m;
    b >>= 1;
  }
  return ans;
}
int main() {
  int l = 0;
  scanf("%d", &n);
  for (int a = 1; a <= n; a++)
    scanf("%d", &z[0][a]), y[++l] = rec(z[0][a], 0, a);
  for (int a = 1; a <= n; a++)
    scanf("%d", &z[1][a]), y[++l] = rec(z[1][a], 1, a);
  scanf("%d", &m);
  fac[0] = 1;
  for (int a = 1; a <= n * 2; a++) {
    int b = a;
    while (b % 2 == 0) b /= 2, er[a]++;
    er[a] += er[a - 1];
    fac[a] = (long long)fac[a - 1] * b % m;
  }
  sort(y + 1, y + (n << 1) + 1, cmp);
  int ans = 1, ercnt = 0;
  for (int a = 1; a <= n * 2;) {
    int b = a, cnt = 0;
    while (y[b].v == y[a].v && b <= 2 * n) {
      if (z[1 - y[b].belong][y[b].id] == y[b].v) cnt++;
      b++;
    }
    b--;
    cnt >>= 1;
    ans = (long long)ans * fac[b - a + 1] % m;
    ercnt += er[b - a + 1] - cnt;
    a = b + 1;
  }
  ans = (long long)ans * mul(2, ercnt) % m;
  printf("%d\n", ans);
  return 0;
}
