#include <bits/stdc++.h>
using namespace std;
int n, a[100005], b[100005], x, y;
map<int, int> P, D;
long long MOD, ret, t;
map<int, int>::iterator itr;
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]);
  for (int i = (0); i < (n); i++) {
    P[a[i]] = P[a[i]] + 1;
    P[b[i]] = P[b[i]] + 1;
    if (a[i] == b[i]) D[a[i]] = D[a[i]] + 1;
  }
  scanf("%I64d", &MOD);
  ret = 1;
  for (itr = P.begin(); itr != P.end(); itr++) {
    x = itr->second;
    y = D[itr->first];
    for (int i = 1; i <= x; i++) {
      t = i;
      while (y && t % 2 == 0) --y, t /= 2;
      ret = (ret * t) % MOD;
    }
  }
  printf("%I64d\n", ret);
  return 0;
}
