#include <bits/stdc++.h>
using namespace std;
long long fact[100005];
int a[100005];
int b[100005];
map<int, int> pairs;
map<int, int> num;
int main() {
  int n, m;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    if (num.find(a[i]) == num.end()) num[a[i]] = 0;
    pairs[a[i]] = 0;
    num[a[i]]++;
  }
  for (int i = 0; i < n; i++) {
    scanf("%d", &b[i]);
    if (num.find(b[i]) == num.end()) num[b[i]] = 0;
    num[b[i]]++;
    if (b[i] == a[i]) pairs[a[i]]++;
  }
  scanf("%d", &m);
  fact[0] = 1;
  for (int i = 1; i <= n; i++) {
    fact[i] = (fact[i - 1] * i) % m;
  }
  long long ans = 1;
  for (int i = 0; i < n; i++) {
    int total = num[a[i]];
    int eq = pairs[a[i]];
    if (total == 0) continue;
    ans = ans * fact[total - 2 * eq];
    ans = ans % m;
    for (int j = total - 2 * eq + 1; j <= total; j++) {
      if (j % 2 == 0)
        ans = ans * j / 2;
      else
        ans = ans * j;
      ans = ans % m;
    }
    num[a[i]] = 0;
  }
  for (int i = 0; i < n; i++) {
    int total = num[b[i]];
    int eq = pairs[b[i]];
    if (total == 0) continue;
    ans = ans * fact[total - 2 * eq];
    ans = ans % m;
    for (int j = total - 2 * eq + 1; j <= total; j++) {
      if (j % 2 == 0)
        ans = ans * j / 2;
      else
        ans = ans * j;
      ans = ans % m;
    }
    num[b[i]] = 0;
  }
  printf("%I64d\n", ans);
}
