#include <bits/stdc++.h>
using namespace std;
vector<int> rep;
int a[100100], b[100100];
int n;
long long p;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= n; i++) scanf("%d", &b[i]);
  for (int i = 1; i <= n; i++) {
    if (a[i] == b[i]) rep.push_back(a[i]);
  }
  sort(a + 1, a + n + 1);
  sort(b + 1, b + n + 1);
  a[n + 1] = 2147483647;
  b[n + 1] = 2147483647;
  sort(rep.begin(), rep.end());
  cin >> p;
  int wa = 1, wb = 1, where = 0;
  long long ans = 1;
  while (1) {
    int tt = min(a[wa], b[wb]);
    int wa1 = wa, wb1 = wb;
    while ((wa <= n) && (a[wa] == tt)) wa++;
    while ((wb <= n) && (b[wb] == tt)) wb++;
    int p0 = 0;
    while ((where < rep.size()) && (rep[where] == a[wa1])) {
      p0++;
      where++;
    }
    for (int i = wa + wb - wa1 - wb1; i > 0; i--) {
      int i1 = i;
      while ((p0) && (i1 % 2 == 0)) {
        i1 /= 2;
        p0--;
      }
      ans *= (long long)i1;
      ans %= p;
    }
    if ((wa > n) && (wb > n)) break;
  }
  cout << (int)ans << endl;
  return 0;
}
