#include <bits/stdc++.h>
using namespace std;
int mod = 1e9 + 7;
long long powmod(long long a, long long b) {
  long long res = 1;
  if (a >= mod) a %= mod;
  for (; b; b >>= 1) {
    if (b & 1) res = res * a;
    if (res >= mod) res %= mod;
    a = a * a;
    if (a >= mod) a %= mod;
  }
  return res;
}
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
pair<int, int> V[200005];
long long m;
long long a;
int s, x;
long long f(int f, int two) {
  a = 1;
  s = 1;
  x = 1;
  while (x <= f) {
    s = x;
    while (s % 2 == 0 && two) {
      s /= 2;
      two--;
    }
    a = a * s % m;
    x++;
  }
  return a;
}
int main() {
  ios_base::sync_with_stdio(false);
  ;
  int i, j, t, n;
  V[0] = make_pair(0, 0);
  cin >> n;
  long long ans;
  for (i = 1; i <= n; i++) {
    cin >> j;
    V[i] = make_pair(j, i);
  }
  for (i = 1; i <= n; i++) {
    cin >> j;
    V[i + n] = make_pair(j, i);
  }
  cin >> m;
  sort(&V[0], &V[2 * n + 1]);
  V[2 * n + 1] = make_pair(0, 0);
  int two = 0;
  ans = 1;
  for (i = 1; i <= 2 * n; i++) {
    j = 1;
    two = 0;
    while (V[i].first == V[i + 1].first) {
      if (V[i] == V[i + 1]) two++;
      i++;
      j++;
    }
    ans = ans * f(j, two) % m;
  }
  cout << ans << '\n';
  return 0;
}
