#include <bits/stdc++.h>
using namespace std;
long long MOD;
pair<int, int> a[100100], b[100100];
bool mk[2 * 100100];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &a[i].first);
  for (int i = 0; i < n; i++) scanf("%d", &b[i].first);
  for (int i = 0; i < n; i++) a[i].second = b[i].second = i + 1;
  sort(a, a + n);
  sort(b, b + n);
  cin >> MOD;
  int p0 = 0, p1 = 0;
  long long rsp = 1LL;
  while (p0 < n || p1 < n) {
    int v;
    long long qtd = 0;
    if (p0 < n && p1 < n)
      v = min(a[p0].first, b[p1].first);
    else if (p0 < n)
      v = a[p0].first;
    else
      v = b[p1].first;
    int aa = p0, bb = p1, cnt = 0;
    while (p0 < n && a[p0].first == v) mk[a[p0].second] = true, p0++, qtd++;
    while (p1 < n && b[p1].first == v) {
      if (mk[b[p1].second]) cnt++;
      p1++, qtd++;
    }
    while (aa < n && a[aa].first == v) mk[a[aa].second] = false, aa++;
    while (qtd) {
      if (cnt) {
        rsp = (rsp * ((qtd * (qtd - 1) / 2LL) % MOD)) % MOD;
        cnt--, qtd -= 2;
      } else {
        rsp = (rsp * qtd) % MOD;
        qtd--;
      }
    }
  }
  cout << rsp << endl;
  return 0;
}
