#include <bits/stdc++.h>
using namespace std;
inline void read(long long &x) {
  x = 0;
  long long f = 1;
  char ch = getchar();
  while ((ch < '0' || ch > '9') && ch != '-') ch = getchar();
  if (ch == '-') {
    f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  x *= f;
}
long long i, j, k, m, n, s, t, mod;
struct point {
  long long x, y;
} a[200001];
long long l[200001], r[200001];
bool cmp(point aa, point bb) {
  if (aa.x != bb.x) return aa.x < bb.x;
  return aa.y < bb.y;
}
signed main() {
  read(n);
  for (i = 1; i <= n; i++) {
    read(a[i].x);
    a[i].y = i;
  }
  for (i = n + 1; i <= 2 * n; i++) {
    read(a[i].x);
    a[i].y = i - n;
  }
  read(mod);
  sort(a + 1, a + n * 2 + 1, cmp);
  for (i = 1; i <= 2 * n; i++) {
    if (a[i].x != a[i - 1].x) r[t] = i - 1, t++, l[t] = i;
  }
  r[t] = 2 * n;
  long long ans = 1;
  for (i = 1; i <= t; i++) {
    long long now = 1, p = 0;
    for (j = l[i] + 1; j <= r[i]; j++)
      if (a[j].y == a[j - 1].y) p++;
    for (j = l[i]; j <= r[i]; j += 2) {
      long long tmp;
      if (j != r[i])
        tmp = (j - l[i] + 1) * (j - l[i] + 2);
      else
        tmp = (j - l[i] + 1);
      if (p) p--, tmp /= 2;
      tmp %= mod;
      now = now * tmp % mod;
    }
    ans = (long long)ans * now % mod;
  }
  cout << ans;
  return 0;
}
