#include <bits/stdc++.h>
using namespace std;
template <class T>
inline string TOSTRING(T n) {
  ostringstream ost;
  ost << n;
  ost.flush();
  return ost.str();
}
template <class T>
inline void TOVAR(string s, T &r) {
  istringstream sin(s);
  sin >> r;
}
template <class T>
inline void FILL1(vector<T> &x, int n, T val) {
  x.clear();
  x.resize(n, val);
}
template <class T>
inline void FILL2(vector<vector<T> > &x, int n, int m, T val) {
  x.clear();
  x.resize(n, vector<T>(m, val));
}
template <class T>
inline void RES1(vector<T> &x, int n) {
  x.clear();
  x.resize(n);
}
template <class T>
inline void RES2(vector<vector<T> > &x, int n, int m) {
  x.clear();
  x.resize(n, vector<T>(m));
}
template <class T>
inline T EUCLIDEAN(T a, T b, T &x, T &y) {
  if (a < 0) {
    T d = EUCLIDEAN(-a, b, x, y);
    x = -x;
    return d;
  }
  if (b < 0) {
    T d = EUCLIDEAN(a, -b, x, y);
    y = -y;
    return d;
  }
  if (b == 0) {
    x = 1;
    y = 0;
    return a;
  } else {
    T d = EUCLIDEAN(b, a % b, x, y);
    T t = x;
    x = y;
    y = t - (a / b) * y;
    return d;
  }
}
template <class T>
inline T MULTIPLYMOD(T a, T b, T m) {
  return (T)((((a * b) % m) + m) % m);
}
template <class T>
inline T DIVIDEMOD(T a, T b, T m) {
  T x, y;
  EUCLIDEAN(b, m, x, y);
  return MULTIPLYMOD(a, x, m);
}
long long MOD;
long long PowMod(long long N, long long P = MOD - 2) {
  if (P == 0) return 1;
  long long res = PowMod(N, P / 2) % MOD;
  if (P & 1)
    return ((res * res) % MOD * N) % MOD;
  else
    return (res * res) % MOD;
}
vector<long long> fact(100010, 1);
vector<long long> two(100010, 1);
void precalculate() {
  for (long long i = 2LL; i < 100010LL; i++) {
    fact[i] = ((fact[i - 1] * i) % MOD + MOD) % MOD;
  }
  two[0] = 1LL;
  two[1] = 2LL;
  for (long long i = 2LL; i < 100010LL; i++) {
    two[i] = ((two[i - 1] * 2) % MOD + MOD) % MOD;
  }
}
int main() {
  double tmp_start = clock();
  fprintf(stderr, "Start\n");
  long long n = ({
    long long int x;
    scanf("%lld", &x);
    x;
  });
  map<long long, long long> N, A;
  vector<long long> arr1, arr2;
  for (long long i = 0LL; i < n; i++) {
    arr1.push_back(({
      long long int x;
      scanf("%lld", &x);
      x;
    }));
  }
  for (long long i = 0LL; i < n; i++) {
    arr2.push_back(({
      long long int x;
      scanf("%lld", &x);
      x;
    }));
  }
  cin >> MOD;
  for (long long i = 0; i < ((int)(arr1).size()); i++) {
    if (arr1[i] == arr2[i]) A[arr1[i]]++;
    N[arr1[i]]++;
    N[arr2[i]]++;
  }
  long long cnt = 1LL;
  map<long long, long long>::iterator it;
  for (it = N.begin(); it != N.end(); it++) {
    int num = it->second;
    int den = A[it->first];
    long long fact = 1LL;
    for (int i = 2; i <= num; i += 2) {
      if (den) {
        fact = (((fact * (i / 2)) % MOD) + MOD) % MOD;
        den--;
      } else
        fact = (((fact * (i)) % MOD) + MOD) % MOD;
      if (i + 1 <= num) fact = (((fact * (i + 1)) % MOD) + MOD) % MOD;
    }
    cnt = MULTIPLYMOD(cnt, fact, MOD);
  }
  cout << cnt << "\n";
  fprintf(stderr, "Total time = %.2lf sec\n",
          (double)(clock() - tmp_start) / CLOCKS_PER_SEC);
  return 0;
}
