#include <bits/stdc++.h>
using namespace std;
struct P {
  long long int x, y;
};
P H[200010];
bool u[200010];
long long int m;
long long ans;
bool cmp(P a, P b) {
  if (a.x < b.x) return 1;
  if (a.x == b.x && a.y < b.y) return 1;
  return 0;
}
void calc(int a, int b) {
  for (int i = 2; i <= a; i++) {
    int x = i;
    while (b && x % 2 == 0) x = x >> 1, b--;
    ans = ans * x % m;
  }
}
int main() {
  int n, a, b;
  while (~scanf("%d", &n)) {
    for (int i = 0; i < n; i++) {
      scanf("%I64d", &H[i].x);
      H[i].y = (long long)i + 1;
    }
    for (int i = n; i < 2 * n; i++) {
      scanf("%I64d", &H[i].x);
      H[i].y = (long long)i - n + 1;
    }
    scanf("%I64d", &m);
    ans = 1;
    sort(H, H + 2 * n, cmp);
    int ok;
    int j = 0, t1 = 0;
    for (int i = 0; i < 2 * n; i++) {
      if (i != j && H[i].y == H[i - 1].y && H[i].x == H[i - 1].x) t1++;
      if (i == 2 * n - 1 || H[i].x != H[i + 1].x) {
        calc(i - j + 1, t1);
        j = i + 1;
        t1 = 0;
      }
    }
    printf("%I64d\n", ans);
  }
  return 0;
}
