#include <bits/stdc++.h>
using namespace std;
struct Element {
  int x, y;
} ele[100005 * 2];
int n, n_2, m, two;
long long ans;
long long diff[100005 * 2];
bool cmp(Element a, Element b) {
  if (a.x != b.x) return a.x < b.x;
  return a.y < b.y;
}
int main() {
  int i, j, pre, v;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> ele[i].x;
    ele[i].y = i + 1;
  }
  for (i = n; i < 2 * n; i++) {
    cin >> ele[i].x;
    ele[i].y = i - n + 1;
  }
  cin >> m;
  sort(ele, ele + 2 * n, cmp);
  pre = i = 0;
  n_2 = n * 2;
  while (i < n_2) {
    while (i < n_2 - 1 && ele[i].x == ele[i + 1].x) {
      if (ele[i].y == ele[i + 1].y) two++;
      i++;
    }
    if (i - pre) diff[pre] = i - pre + 1;
    pre = ++i;
  }
  ans = 1;
  for (i = 0; i < n_2; i++)
    if (diff[i]) {
      for (j = 2; j <= diff[i]; j++) {
        v = j;
        while (!(v & 1) && two) {
          v = v >> 1;
          two--;
        }
        ans = (ans * v) % m;
      }
    }
  cout << ans << endl;
  return 0;
}
