#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/STACK:64000000")
const int MAXN = (1 << 17);
const int MAXM = (1 << 18);
int n, m, l, k;
int a[MAXN];
int b[MAXN];
pair<int, int> c[MAXM];
inline void init() {
  l = 0;
  k = 0;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &a[i]);
    c[l++] = pair<int, int>(a[i], 0);
  }
  for (int i = 0; i < n; ++i) {
    scanf("%d", &b[i]);
    int z = 0;
    if (b[i] == a[i]) z = 1;
    c[l++] = pair<int, int>(b[i], z);
  }
  scanf("%d", &m);
}
int main() {
  init();
  sort(c, c + l);
  long long res = 1;
  for (int i = 0; i < l;) {
    int j = i + 1;
    int z = c[i].second;
    while (j < l && c[j].first == c[i].first) {
      z += c[j].second;
      ++j;
    }
    int lim = (j - i);
    for (int t = 2; t <= lim; ++t) {
      long long x = t;
      while (z && (x % 2 == 0)) {
        x /= 2;
        --z;
      }
      res *= x;
      res %= m;
    }
    i = j;
  }
  res %= m;
  cout << res << endl;
  return 0;
}
