#include <bits/stdc++.h>
using namespace std;
const int MAXN = 105050;
int n;
long long mod;
int A[MAXN], B[MAXN];
long long calc(long long fcnt, long long dcnt) {
  long long ret = 1;
  for (long long i = 2; i <= fcnt; i++) {
    if (dcnt > 0 && (i & 1) == 0) {
      dcnt--;
      ret *= i / 2;
    } else
      ret *= i;
    ret %= mod;
  }
  return ret % mod;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &A[i]);
  }
  for (int i = 1; i <= n; i++) {
    scanf("%d", &B[i]);
  }
  scanf("%lld", &mod);
  vector<pair<int, int> > v;
  for (int i = 1; i <= n; i++) {
    v.push_back({A[i], i});
    v.push_back({B[i], i});
  }
  sort(v.begin(), v.end());
  v.push_back({-1, -1});
  long long ans = 1;
  int curf = v[0].first;
  int curs = v[0].second;
  long long curfcnt = 1;
  long long curscnt = 1;
  long long dcnt = 0;
  for (int i = 1; i <= 2 * n; i++) {
    if (v[i].first == curf) {
      curfcnt++;
      if (v[i].second == curs) {
        curscnt++;
      } else {
        if (curscnt > 1) dcnt++;
        curscnt = 1;
        curs = v[i].second;
      }
    } else {
      if (curscnt > 1) dcnt++;
      long long ret = calc(curfcnt, dcnt);
      ans *= ret;
      ans %= mod;
      dcnt = 0;
      curf = v[i].first;
      curs = v[i].second;
      curfcnt = 1;
      curscnt = 1;
    }
  }
  printf("%lld", ans);
  return 0;
}
