#include <bits/stdc++.h>
using namespace std;
int a[2][200000];
int M;
struct point {
  int x, y;
  int id;
} pai[300000];
bool cmp(point A, point B) { return A.x < B.x; }
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[0][i]);
    pai[i].y = i;
    pai[i].x = a[0][i];
    pai[i].id = 0;
  }
  for (int i = 1; i <= n; i++)
    scanf("%d", &a[1][i]), pai[i + n].y = i, pai[i + n].x = a[1][i],
                                   pai[i + n].id = 1;
  sort(pai + 1, pai + 1 + 2 * n, cmp);
  scanf("%d", &M);
  int num = 0, k = 0;
  long long ans = 1;
  for (int i = 1; i <= 2 * n; i++) {
    if (i == 1) {
      num++;
      if (a[pai[i].id ^ 1][pai[i].y] == pai[i].x) k++;
      continue;
    }
    if (pai[i - 1].x != pai[i].x) {
      k /= 2;
      long long lin = 1;
      for (int i = 1; i <= num; i++) {
        lin *= i;
        while (lin % 2 == 0 && k) {
          lin /= 2;
          k--;
        }
        lin = lin % M;
      }
      ans = ans * lin % M;
      num = 0;
    }
    num++;
    if (a[pai[i].id ^ 1][pai[i].y] == pai[i].x) k++;
  }
  if (num > 1) {
    k /= 2;
    long long lin = 1;
    for (int i = 1; i <= num; i++) {
      lin *= i;
      while (lin % 2 == 0 && k) {
        lin /= 2;
        k--;
      }
      lin = lin % M;
    }
    ans = ans * lin % M;
  }
  printf("%I64d\n", ans);
}
