#include <bits/stdc++.h>
using namespace std;
struct point {
  long long int x, y;
  point() {}
  point(long long int _x, long long int _y) {
    x = _x;
    y = _y;
  }
};
bool cmp(const point &a, const point &b) {
  if (a.x == b.x) return a.y < b.y;
  return a.x < b.x;
}
struct freq {
  long long int x_freq;
  set<long long int> y_freq;
};
freq freq_list[200005];
point S[200010];
long long int mod;
long long int fact_mod(long long int k) {
  long long int ans = 1;
  while (k > 0) {
    ans = (ans % mod * k % mod) % mod;
    --k;
  }
  return ans % mod;
}
int main() {
  int N;
  cin >> N;
  for (int i = 0; i < N; ++i) {
    int x;
    cin >> x;
    S[i] = point(x, i);
  }
  for (int i = 0; i < N; ++i) {
    int x;
    cin >> x;
    S[N + i] = point(x, i);
  }
  cin >> mod;
  sort(S, S + 2 * N, cmp);
  int last = -1, cnt = -1, m;
  for (int i = 0; i < 2 * N; ++i) {
    if (S[i].x != last) {
      ++cnt;
      last = S[i].x;
      freq_list[cnt].x_freq = 1;
      freq_list[cnt].y_freq.insert(S[i].y);
    } else {
      ++freq_list[cnt].x_freq;
      freq_list[cnt].y_freq.insert(S[i].y);
    }
  }
  long long int ans = 1, n;
  for (int i = 0; i <= cnt; ++i) {
    m = freq_list[i].x_freq - freq_list[i].y_freq.size();
    n = freq_list[i].x_freq;
    int k = n;
    for (int j = 0; j < m; ++j) {
      ans = ((ans % mod) * ((n * (n - 1) / 2LL) % mod)) % mod;
      n -= 2;
    }
    ans = ((ans % mod) * (fact_mod(k - 2 * m) % mod)) % mod;
  }
  cout << ans % mod << endl;
  return 0;
}
