#include <bits/stdc++.h>
using namespace std;
int mod;
long long fact(long long n, long long k) {
  long long ret = 1;
  for (long long i = 1; i <= n; ++i) {
    long long j = i;
    for (; k && j % 2 == 0;) {
      j /= 2;
      --k;
    }
    ret = (ret * j) % mod;
  }
  return ret;
}
int main() {
  int N;
  while (scanf("%d", &N) != EOF) {
    map<int, map<int, int> > v;
    for (int i = 0; i < (int)(N); ++i) {
      int x;
      scanf("%d", &x);
      v[x][i]++;
    }
    for (int i = 0; i < (int)(N); ++i) {
      int x;
      scanf("%d", &x);
      v[x][i]++;
    }
    scanf("%d", &mod);
    long long ret = 1;
    for (__typeof((v).begin()) it = (v).begin(); it != (v).end(); ++it) {
      map<int, int> &m = it->second;
      int tot = 0, k = 0;
      for (__typeof((m).begin()) jt = (m).begin(); jt != (m).end(); ++jt) {
        tot += jt->second;
        if (jt->second == 2) k++;
      }
      ret = (ret * fact(tot, k)) % mod;
    }
    printf("%d\n", (int)ret);
  }
}
