#include <bits/stdc++.h>
using namespace std;
const int MAX = 200005;
vector<pair<long long, long long> > pares;
int n;
long long MOD, fact[MAX], pot[MAX];
void pre_calculo() {
  fact[0] = 1;
  pot[0] = 1;
  int res;
  for (int i = (int)1; i < (int)2 * n + 5; i++) {
    res = i;
    while (res % 2 == 0) {
      res = res / 2;
    }
    fact[i] = (fact[i - 1] * res) % MOD;
    pot[i] = (2 * pot[i - 1]) % MOD;
  }
}
int expn(long long b) {
  int ans = 0;
  long long pot = 2;
  long long aux = b / 2;
  while (aux != 0) {
    ans += aux;
    pot *= 2;
    aux = b / pot;
  }
  return ans;
}
int main() {
  long long aux;
  scanf("%d", &n);
  for (int i = 0; i < (int)n; i++) {
    cin >> aux;
    pares.push_back(make_pair(aux, i + 1));
  }
  for (int i = 0; i < (int)n; i++) {
    cin >> aux;
    pares.push_back(make_pair(aux, i + 1));
  }
  cin >> MOD;
  sort(pares.begin(), pares.end());
  pre_calculo();
  long long ans = 1;
  int i = 0;
  long long tmp, sum;
  int exp2;
  while (i < 2 * n) {
    tmp = pares[i].first;
    sum = 0;
    exp2 = 0;
    while (pares[i].first == tmp) {
      if (i and (pares[i] == pares[i - 1])) exp2++;
      sum++;
      i++;
    }
    ans = (ans * fact[sum]) % MOD;
    ans = (ans * pot[expn(sum) - exp2]) % MOD;
  }
  cout << ans << endl;
  return 0;
}
