#include <bits/stdc++.h>
using namespace std;
__inline bool nextInt(int &val) {
  char ch;
  int sgn = 1;
  while ((ch = getchar()) != EOF) {
    if (ch == '-') sgn = -1;
    if (ch >= '0' && ch <= '9') break;
  }
  if (ch == EOF) return false;
  val = (int)(ch - '0');
  while (true) {
    ch = getchar();
    if (ch >= '0' && ch <= '9') {
      val = 10 * val + (int)(ch - '0');
    } else
      break;
  }
  val *= sgn;
  return true;
}
__inline bool nextString(string &s) {
  char ch;
  while ((ch = getchar()) != EOF) {
    if (ch >= 33 && ch <= 126) break;
  }
  if (ch == EOF) return false;
  s = string(1, ch);
  while (true) {
    ch = getchar();
    if (ch >= 33 && ch <= 126) {
      s = s + string(1, ch);
    } else
      break;
  }
  return true;
}
int n, m, modul, v[200050], p2[200050], fact[200050];
vector<pair<int, int> > a, b;
map<int, int> used[200050], id;
int mp(int n, int deg) {
  if (deg == 0) return 1;
  int tmp = mp(n, deg / 2);
  tmp = (((long long)(tmp) * (long long)(tmp)) % modul);
  if (deg & 1) tmp = (((long long)(n) * (long long)(tmp)) % modul);
  return tmp;
}
int inv(int n) { return mp(n, modul - 2); }
int main() {
  ios_base::sync_with_stdio(false);
  scanf("%d", &n);
  for (int i = 0; i < (n); i++) {
    scanf("%d", v + i);
    a.push_back(pair<int, int>(v[i], i));
  }
  for (int i = 0; i < (n); i++) {
    scanf("%d", v + (n + i));
    b.push_back(pair<int, int>(v[n + i], i));
  }
  scanf("%d", &modul);
  m = 2 * n;
  p2[0] = 1;
  for (int i = (1); i < (m + 1); i++)
    p2[i] = (((long long)(p2[i - 1]) * (long long)(2)) % modul);
  fact[0] = 1;
  for (int i = (1); i < (m + 1); i++)
    fact[i] = (((long long)(fact[i - 1]) * (long long)(i)) % modul);
  sort(v, v + m);
  m = unique(v, v + m) - v;
  for (int i = 0; i < (m); i++) id[v[i]] = i;
  for (int i = 0; i < (n); i++) {
    int x = id[a[i].first], y = a[i].second;
    if (used[x].count(y) == 0) {
      used[x][y] = 1;
    } else
      used[x][y]++;
  }
  for (int i = 0; i < (n); i++) {
    int x = id[b[i].first], y = b[i].second;
    if (used[x].count(y) == 0) {
      used[x][y] = 1;
    } else
      used[x][y]++;
  }
  int ret = 1;
  for (int i = 0; i < (m); i++) {
    int sum = 0, total = 0;
    for (map<int, int>::iterator it = used[i].begin(); it != used[i].end();
         ++it) {
      sum += it->second;
      total++;
    }
    int left = sum - total;
    for (int _k = 1; _k <= sum; _k++) {
      int k = _k;
      while (left > 0 && k % 2 == 0) {
        k /= 2;
        left--;
      }
      ret = (((long long)(ret) * (long long)(k)) % modul);
    }
  }
  printf("%d\n", ret);
  return 0;
}
