#include <bits/stdc++.h>
using namespace std;
const int maxn = 200005;
struct node {
  long long x, y;
} q[maxn];
int tp, n;
long long d[maxn];
long long m;
long long cal() {
  long long r = 1;
  long long i, tot = 0, s = 0, num = 0;
  d[tp] = -1;
  for (i = 0; i < tp; i++) {
    s++;
    num++;
    if (d[i] != d[i + 1]) {
      if (num == 2)
        r = (((tot + 1) * (tot + 2) / 2) % m * r) % m;
      else
        r = (r * (tot + 1)) % m;
      num = 0;
      tot = s;
    }
  }
  return r;
}
bool cmp(node a, node b) {
  if (a.x != b.x) return a.x < b.x;
  return a.y < b.y;
}
int main() {
  long long i;
  long long r, res;
  while (scanf("%d", &n) != EOF) {
    for (i = 0; i < n; i++) {
      scanf("%I64d", &q[i].x);
      q[i].y = i + 1;
    }
    for (i = 0; i < n; i++) {
      scanf("%I64d", &q[i + n].x);
      q[i + n].y = i + 1;
    }
    scanf("%I64d", &m);
    sort(q, q + 2 * n, cmp);
    q[2 * n].x = q[2 * n].y = -1;
    tp = 0;
    res = 1;
    for (i = 0; i < 2 * n; i++) {
      d[tp++] = q[i].y;
      if (q[i].x != q[i + 1].x) {
        r = cal();
        res = (res * r) % m;
        tp = 0;
      }
    }
    printf("%I64d\n", res);
  }
  return 0;
}
