#include <bits/stdc++.h>
using namespace std;
int i, j, k, l, n, m, num, x;
long long ans;
struct ppp {
  int x, y;
  void make(int x_, int y_) {
    x = x_;
    y = y_;
  }
} a[240000];
bool cmp(const ppp& a, const ppp& b) {
  return a.x < b.x || a.x == b.x && a.y < b.y;
}
long long C(long long num, int x) {
  if (x == 1) return num;
  return num * (num - 1) / 2 % m;
}
int main() {
  scanf("%d", &n);
  for (i = 1; i <= n; ++i) scanf("%d", &x), a[i].make(x, i);
  for (i = 1; i <= n; ++i) scanf("%d", &x), a[i + n].make(x, i);
  n *= 2;
  sort(a + 1, a + n + 1, cmp);
  ans = 1;
  scanf("%d", &m);
  for (i = 1; i <= n; i = j) {
    for (j = i; j <= n && a[j].x == a[i].x; ++j)
      ;
    num = j - i;
    for (k = i; k < j; ++k) {
      if (a[k].x == a[k + 1].x && a[k].y == a[k + 1].y) {
        ans = ans * C(num, 2) % m;
        num -= 2;
        k++;
      } else {
        ans = ans * C(num, 1) % m;
        num--;
      }
    }
  }
  printf("%I64d\n", ans);
}
