#include <bits/stdc++.h>
using namespace std;
int A[200010];
int B[200010];
map<int, int> M;
int MO;
int facto[200010];
void genfacto(int N = 200005) {
  facto[0] = 1;
  for (int i = 1; i < N; ++i) facto[i] = (1LL * i * facto[i - 1]) % MO;
}
int main(int argc, char* argv[]) {
  int N;
  cin >> N;
  set<pair<int, int> > S;
  map<int, int> PAIRS;
  for (int i = 0; i < N; ++i) {
    cin >> A[i];
    S.insert(pair<int, int>(A[i], i + 1));
    M[A[i]]++;
  }
  for (int i = 0; i < N; ++i) {
    cin >> B[i];
    if (S.count(pair<int, int>(B[i], i + 1))) PAIRS[B[i]]++;
    S.insert(pair<int, int>(B[i], i + 1));
    M[B[i]]++;
  }
  cin >> MO;
  genfacto();
  int ans = 1;
  for (map<int, int>::iterator it = M.begin(); it != M.end(); ++it) {
    int pc = PAIRS.count(it->first) ? PAIRS[it->first] : 0;
    int fac = 1;
    for (int j = 1; j <= it->second; ++j) {
      int cj = j;
      while (pc && cj % 2 == 0) {
        cj /= 2;
        pc--;
      }
      fac = (1LL * fac * cj) % MO;
    }
    ans = (1LL * ans * fac) % MO;
  }
  cout << ans << endl;
}
