#include <bits/stdc++.h>
using namespace std;
const int maxn = 100010;
int a[maxn], b[maxn];
map<int, int> cnt;
int m, n;
int c2 = 0;
long long int ans = 1;
void calc(int x) {
  for (int i = 2; i <= x; i++) {
    int t = i;
    if (c2 && !(t & 1)) {
      t >>= 1;
      c2--;
    }
    ans = (ans * t) % m;
  }
}
int main() {
  cnt.clear();
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  for (int i = 0; i < n; i++) scanf("%d", &b[i]);
  scanf("%d", &m);
  for (int i = 0; i < n; i++) {
    if (a[i] == b[i]) c2++;
    cnt[a[i]]++, cnt[b[i]]++;
  }
  map<int, int>::iterator it;
  for (it = cnt.begin(); it != cnt.end(); it++) calc(it->second);
  printf("%I64d", ans);
  return 0;
}
