#include <bits/stdc++.h>
using namespace std;
int n;
int aInd[100010];
map<int, pair<int, int> > h;
long long f[100010];
long long m;
int main() {
  int x;
  int k;
  long long k1;
  long long res = 1LL;
  map<int, pair<int, int> >::iterator it;
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &x);
    it = h.find(x);
    if (it == h.end()) {
      it = h.insert(make_pair(x, make_pair(0, 0))).first;
    }
    ++((it->second).first);
    aInd[i] = x;
  }
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &x);
    it = h.find(x);
    if (it == h.end()) {
      it = h.insert(make_pair(x, make_pair(0, 0))).first;
    }
    ++((it->second).first);
    if (aInd[i] == x) {
      ++((it->second).second);
    }
  }
  scanf("%d", &x);
  m = (long long)x;
  f[0] = 1LL;
  for (int i = 1; i <= n; ++i) {
    f[i] = (f[i - 1] * ((long long)i)) % m;
  }
  f[n + 1] = (f[n] * ((long long)(n + 1))) % m;
  for (it = h.begin(); it != h.end(); ++it) {
    k = ((it->second).first) - 2 * ((it->second).second);
    res = (res * f[k]) % m;
    ++k;
    for (int i = 0; i < ((it->second).second); ++i) {
      k1 = (((long long)k) * ((long long)(k + 1)) / 2LL) % m;
      res = (res * k1) % m;
      k += 2;
    }
  }
  cout << res << '\n';
  return 0;
}
