#include <bits/stdc++.h>
using namespace std;
const int MaxN = 1 << 18;
int N;
long long int M;
vector<pair<int, int> > Points;
int main(void) {
  scanf("%d", &N);
  for (int i = 0; i < N; i++) {
    int A;
    scanf("%d", &A);
    Points.push_back(make_pair(A, i));
  }
  for (int i = 0; i < N; i++) {
    int B;
    scanf("%d", &B);
    Points.push_back(make_pair(B, i));
  }
  sort(Points.begin(), Points.end());
  scanf("%I64d", &M);
  long long int Sol = 1LL;
  int idx = 0;
  while (idx < 2 * N) {
    int idy = idx, idz = idx;
    while ((idy < 2 * N) && (Points[idy].first == Points[idx].first)) idy++;
    int Cnt = idy - idx;
    while (idz + 1 < idy) {
      long long int Curr = 1LL;
      if (Points[idz].second == Points[idz + 1].second) {
        Curr *= Cnt * (Cnt - 1LL);
        Curr /= 2LL;
        idz += 2;
        Cnt -= 2;
      } else {
        Curr *= Cnt;
        idz++;
        Cnt--;
      }
      Curr %= M;
      Sol = (Sol * Curr) % M;
    }
    idx = idy;
  }
  printf("%I64d\n", Sol);
  return 0;
}
