#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-9;
const double PI = acos(-1.0);
const int MAXN = (int)1e5 + 10;
int first[MAXN * 3];
int need[MAXN * 3];
int val[MAXN * 3];
int n, m;
int a[MAXN];
int b[MAXN];
long long pow2 = 0;
int v[MAXN * 3];
int mul(int x, int y) {
  long long M = 1LL * x * y;
  M %= 1LL * m;
  return (int)M;
}
int mpow(int x, long long p) {
  int res = 1;
  while (p > 0) {
    if (p % 2LL == 1LL) res = mul(res, x);
    p /= 2LL;
    x = mul(x, x);
  }
  return res;
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  for (int i = 0; i < n; i++) {
    scanf("%d", &b[i]);
    if (a[i] == b[i]) pow2++;
  }
  memset(first, 0, sizeof first);
  for (int i = 0; i < n; i++) {
    v[i] = a[i];
    v[n + i] = b[i];
  }
  sort(v, v + 2 * n);
  int len = 1;
  for (int i = 1; i < 2 * n; i++)
    if (v[i] != v[i - 1]) {
      first[len]++;
      len = 1;
    } else
      len++;
  first[len]++;
  int want = 0;
  for (int i = 2 * n; i >= 1; i--) {
    want += first[i];
    need[i] = want;
    val[i] = i;
  }
  scanf("%d", &m);
  long long haspow2 = 0;
  for (int i = 1; i <= 2 * n; i++) {
    while (val[i] % 2 == 0) {
      val[i] /= 2;
      haspow2 += need[i];
    }
  }
  pow2 = haspow2 - pow2;
  int res = 1;
  for (int i = 1; i <= 2 * n; i++) res = mul(res, mpow(val[i], need[i]));
  res = mul(res, mpow(2, pow2));
  printf("%d\n", res);
  return 0;
}
