#include <bits/stdc++.h>
using namespace std;
const int INF = 1000000001;
const double EPS = 10e-9;
const int MAXN = 100005;
pair<int, int> t[MAXN << 1];
int MOD;
void rob() {
  int n;
  scanf("%d", &n);
  int tmp;
  for (typeof(0) i = (0); i < (n); ++i) {
    scanf("%d", &tmp);
    t[i] = make_pair(tmp, i);
  }
  for (typeof(0) i = (0); i < (n); ++i) {
    scanf("%d", &tmp);
    t[n + i] = make_pair(tmp, i);
  }
  scanf("%d", &MOD);
  n <<= 1;
  sort(t, t + n);
  long long res = 1;
  int i = 0;
  int pow;
  int fac;
  while (i < n) {
    fac = 1;
    pow = 0;
    for (++i; i < n; ++i) {
      if (t[i].first != t[i - 1].first) break;
      if (t[i].second == t[i - 1].second) ++pow;
      ++fac;
    }
    for (typeof(1) j = (1); j <= (fac); ++j) {
      if (pow && !(j & 1)) {
        res = (res * (j >> 1)) % MOD;
        --pow;
      } else {
        res = (res * j) % MOD;
      }
    }
  }
  printf("%I64d\n", res);
}
int main() {
  int test = 1;
  while (test--) rob();
  return 0;
}
