#include <bits/stdc++.h>
using namespace std;
const int INF = int(1e9);
const double EPS = 1e-5;
const long long mod = ((long long)1e18) - 131;
int n, x, t[100005], b[100005];
vector<int> a;
long long c = 0, m, ans = 0;
long double fct;
map<int, int> h;
long long clc(int x, int num) {
  long long fct = 1, y = 0;
  bool f = 0;
  for (long i = 2; i <= x; i++) {
    fct *= 1ll * i;
    if (!f)
      if (fct % 2 == 0) {
        if (y < h[num]) {
          y++;
          fct /= 2;
        } else
          f = 1;
      }
    fct %= m;
  }
  return fct % m;
}
int main() {
  scanf("%d", &n);
  for (long i = 0; i < n; i++) {
    scanf("%d", &x);
    a.push_back(x);
    t[i] = x;
  }
  for (long i = 0; i < n; i++) {
    scanf("%d", &x);
    a.push_back(x);
    if (t[i] == x) h[x]++;
  }
  scanf("%I64d", &m);
  sort(a.begin(), a.end());
  x = 0;
  ans = 1;
  for (long i = 0; i < 2 * n; i++) {
    if (!i) {
      x = 1;
      continue;
    }
    if (a[i] != a[i - 1]) {
      ans *= clc(x, a[i - 1]);
      ans %= m;
      x = 1;
    } else {
      x++;
    }
  }
  if (x > 1) {
    ans *= clc(x, a[n * 2 - 1]);
    ans %= m;
  }
  printf("%I64d", ans);
  return 0;
}
