#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 3;
pair<int, int> a[N];
int n, m, p[N];
long long calc(int sz) {
  int cnt = 0, k;
  long long res = 1;
  for (int i = 0; i <= sz; ++i)
    if (p[i] == 2)
      ++cnt;
    else if (p[i] > 2)
      assert(false);
  k = sz + cnt + 1;
  for (int i = 2; i <= k; ++i) {
    int x = i;
    while (x % 2 == 0 && cnt) {
      --cnt;
      x /= 2;
    }
    res = res * x % m;
  }
  assert(0 == cnt);
  return res;
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> a[i].first;
    a[i].second = i;
  }
  for (int i = 0; i < n; ++i) {
    cin >> a[i + n].first;
    a[i + n].second = i;
  }
  cin >> m;
  n <<= 1;
  sort(a, a + n);
  int pre = a[0].first, sz;
  long long res = 1;
  for (int i = 1; i < n; ++i) {
    p[sz = 0] = 1;
    while (i < n && a[i].first == pre) {
      if (a[i].second != a[i - 1].second)
        p[++sz] = 1;
      else
        ++p[sz];
      ++i;
    }
    res = res * calc(sz) % m;
    if (i < n) pre = a[i].first;
  }
  cout << res << endl;
  return 0;
}
