#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2 * 1000 * 100 + 10;
int a[MAXN], b[MAXN];
int vv[MAXN];
set<pair<int, int> > q;
map<int, int> M;
int cnt;
long long m;
long long ans = 1;
long long find(int aa, int bb) {
  long long res = 1;
  for (int i = 1; i <= aa; i++) {
    long long w = i;
    while (bb > 0 and (w % 2 == 0)) {
      w /= 2;
      bb--;
    }
    res *= w;
    res %= m;
  }
  return res;
}
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= 2 * n; i++) cin >> vv[i];
  cin >> m;
  for (int i = 1; i <= n; i++) {
    int aa = vv[i];
    if (M.find(aa) == M.end()) M[aa] = ++cnt;
    q.insert(make_pair(M[aa], i));
    a[M[aa]]++;
  }
  for (int i = 1; i <= n; i++) {
    int bb = vv[n + i];
    if (M.find(bb) == M.end()) {
      M[bb] = ++cnt;
    } else {
      if (q.find(make_pair(M[bb], i)) != q.end()) b[M[bb]]++;
    }
    a[M[bb]]++;
  }
  for (int i = 1; i <= cnt; i++) {
    ans *= find(a[i], b[i]);
    ans %= m;
  }
  cout << ans << endl;
  return 0;
}
