#include <bits/stdc++.h>
using namespace std;
int powmod(long long x, long long y, int MOD) {
  long long a = x % MOD, b = 1 % MOD;
  while (y) {
    if (y & 1) {
      (b *= a) %= MOD;
    }
    (a *= a) %= MOD;
    y >>= 1;
  }
  return (int)b;
}
const int PRIMEFACTORIZES_MAXN = 211111;
int primeFactor[PRIMEFACTORIZES_MAXN + 1];
void primeFactorizes() {
  primeFactor[1] = 1;
  for (int(i) = (int)(2); (i) <= (int)(PRIMEFACTORIZES_MAXN); ++(i))
    if (!primeFactor[i]) {
      primeFactor[i] = i;
      if ((long long)i * i <= PRIMEFACTORIZES_MAXN)
        for (int j = i * i; j <= PRIMEFACTORIZES_MAXN; j += i) {
          if (!primeFactor[j]) primeFactor[j] = i;
        }
    }
}
int main() {
  int n, MOD;
  scanf("%d", &n);
  static int a[111111], b[111111];
  for (int(i) = 0; (i) < (int)(n); ++(i)) scanf("%d", &a[i]);
  for (int(i) = 0; (i) < (int)(n); ++(i)) scanf("%d", &b[i]);
  scanf("%d", &MOD);
  map<int, int> c;
  int d = 0;
  for (int(i) = 0; (i) < (int)(n); ++(i)) c[a[i]]++, c[b[i]]++;
  for (int(i) = 0; (i) < (int)(n); ++(i))
    if (a[i] == b[i]) d++;
  static int f[211111];
  for (typeof((c).begin()) i = ((c).begin()); i != (c).end(); ++i) {
    f[1]++;
    f[i->second + 1]--;
  }
  for (int(i) = (int)(1); (i) <= (int)(210000); ++(i)) f[i] += f[i - 1];
  primeFactorizes();
  static long long g[211111];
  for (int(i) = (int)(1); (i) <= (int)(210000); ++(i)) {
    int x = i;
    while (x != 1) {
      g[primeFactor[x]] += f[i];
      x /= primeFactor[x];
    }
  }
  g[2] -= d;
  long long r = 1;
  for (int(i) = (int)(1); (i) <= (int)(210000); ++(i))
    if (primeFactor[i] == i) {
      (r *= powmod(i, g[i], MOD)) %= MOD;
    }
  printf("%I64d\n", r);
  return 0;
}
