#include <bits/stdc++.h>
using namespace std;
long long a[200003], fact[200003], b[200002], c[200002], d[200002];
int main() {
  long long n, m;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    d[i] = a[i];
  }
  long long j = 0, k = 0;
  for (int i = 0; i < n; i++) {
    long long x;
    cin >> x;
    if (x == a[i]) {
      c[k] = x;
      k++;
    } else {
      b[j] = x;
      j++;
      b[j] = a[i];
      j++;
    }
    d[n + i] = x;
  }
  cin >> m;
  fact[0] = 1;
  for (int i = 1; i < 200003; i++) fact[i] = (fact[i - 1] * i) % m;
  sort(b, b + j);
  sort(c, c + k);
  long long ans = 1;
  for (int i = 0; i < j; i++) {
    long long t = 1;
    while (i < j && b[i] == b[i + 1]) {
      t++;
      i++;
    }
    ans = (ans * fact[t]) % m;
  }
  sort(d, d + n * 2);
  long long x = 0;
  for (int i = 0; i < k; i++) {
    while (x < n * 2 && c[i] > d[x]) x++;
    long long t = 0;
    while (x < n * 2 && c[i] == d[x]) {
      t++;
      x++;
    }
    ans = (ans * ((t * (t - 1) / 2) % m)) % m;
    t -= 2;
    while (i < k && c[i] == c[i + 1]) {
      ans = (ans * ((t * (t - 1) / 2) % m)) % m;
      t -= 2;
      i++;
    }
  }
  cout << ans << endl;
  return 0;
}
