#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > v;
int N, M;
long long f(int a, int b) {
  long long res = 1;
  for (int i = 1; i <= a; i++) {
    int ii = i;
    while (b > 0 && ii % 2 == 0) {
      ii /= 2;
      b--;
    }
    res = (res * ii) % M;
  }
  return res;
}
int main() {
  scanf("%d", &N);
  for (int i = 0; i < N; i++) {
    int x;
    scanf("%d", &x);
    v.push_back(make_pair(x, i + 1));
  }
  for (int i = 0; i < N; i++) {
    int x;
    scanf("%d", &x);
    v.push_back(make_pair(x, i + 1));
  }
  scanf("%d", &M);
  sort(v.begin(), v.end());
  long long res = 1;
  int cnt = 0;
  int b = 0;
  for (int i = 0; i < N * 2; i++) {
    if (i > 0 && v[i].first != v[i - 1].first) {
      res = (res * f(cnt, b)) % M;
      cnt = 1;
      b = 0;
    } else {
      if (i != 0 && v[i] == v[i - 1]) b++;
      cnt++;
    }
  }
  res = (res * f(cnt, b)) % M;
  cout << res << "\n";
  return 0;
}
