#include <bits/stdc++.h>
const double PI = acos(-1.0);
using namespace std;
int setb(int n, int pos) { return n = n | (1 << pos); }
int resb(int n, int pos) { return n = n & ~(1 << pos); }
bool checkb(long long n, long long pos) { return (bool)(n & (1ll << pos)); }
long long bigmod(long long b, long long p, long long m) {
  if (p == 0) return 1;
  long long ret = bigmod(b, p / 2, m);
  ret = (ret * ret) % m;
  if (p & 1) ret = (ret * b) % m;
  return ret;
}
long long n, m, ara[100005], bra[100005];
struct info {
  long long x, y;
  info() {}
  info(long long x, long long y) : x(x), y(y) {}
  bool operator<(const info &p) const {
    if (x == p.x)
      return y < p.y;
    else
      return x < p.x;
  }
};
info lol[2 * 100005];
long long go(long long st, long long ed) {
  vector<long long> v;
  long long cnt = 0;
  for (int i = st + 1; i <= ed; i++) {
    if (lol[i].y == lol[i - 1].y) cnt++;
  }
  assert(cnt * 2 <= ed - st + 1);
  for (int i = st, j = 1; i <= ed; i++, j++) {
    if (cnt && j % 2 == 0) {
      cnt--;
      v.push_back(j / 2);
    } else
      v.push_back(j);
  }
  assert(cnt == 0);
  long long ret = 1;
  for (int i = 0; i < (int)v.size(); i++) ret = (ret * v[i]) % m;
  return ret;
}
long long solve() {
  long long ret = 1;
  for (int i = 1; i <= 2 * n; i++) {
    int st = i;
    int ed;
    for (int j = i; j <= 2 * n; j++) {
      if (lol[j].x != lol[i].x) break;
      ed = j;
    }
    i = ed;
    ret = (ret * go(st, ed)) % m;
  }
  return ret;
}
int main() {
  long long i, j;
  scanf("%lld", &n);
  for (i = 1; i <= n; i++) scanf("%lld", &ara[i]), lol[i] = info(ara[i], i);
  for (i = 1; i <= n; i++) scanf("%lld", &bra[i]), lol[n + i] = info(bra[i], i);
  sort(lol + 1, lol + 2 * n + 1);
  scanf("%lld", &m);
  long long ret = solve();
  printf("%lld", ret);
  printf("\n");
  return 0;
}
