#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > V;
long long f(int a, int cntpar, int m) {
  long long dev = 1;
  for (int i = 2; i <= a; i++) {
    if (cntpar && !(i & 1)) {
      dev = (dev * i / 2) % m;
      cntpar--;
    } else
      dev = (dev * i) % m;
  }
  return dev;
}
int main() {
  int n, m, a;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a);
    V.push_back(make_pair(a, i + 1));
  }
  for (int i = n; i < 2 * n; i++) {
    scanf("%d", &a);
    V.push_back(make_pair(a, i - n + 1));
  }
  scanf("%d", &m);
  sort(V.begin(), V.end());
  long long ans = 1, cnt = 1, cntpar = 0;
  for (int i = 1; i <= 2 * n; i++)
    if (V[i].first == V[i - 1].first) {
      if (V[i].second == V[i - 1].second) cntpar++;
      cnt++;
    } else {
      ans = (ans * f(cnt, cntpar, m)) % m;
      cnt = 1;
      cntpar = 0;
    }
  cout << ans << endl;
}
