#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("sse4")
#pragma GCC optimize("unroll-loops")
using namespace std;
long long fact[200005], p2[200005];
pair<int, int> A[200005];
int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, i, j, k, m, x;
  long long res = 1;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> A[i].first;
    A[i].second = i + 1;
  }
  for (i = n; i < 2 * n; i++) {
    cin >> A[i].first;
    A[i].second = i - n + 1;
  }
  cin >> m;
  for (i = fact[0] = p2[0] = 1; i <= 200000; i++) {
    p2[i] = (2 * p2[i - 1]) % m;
    x = i;
    while (x % 2 == 0) x /= 2;
    fact[i] = (x * fact[i - 1]) % m;
  }
  sort(A, A + 2 * n);
  for (i = 0; i < 2 * n; i = j) {
    for (j = i; j < 2 * n and A[j].first == A[i].first; j++)
      ;
    x = 0;
    for (k = i; k < j - 1; k++) x -= (A[k] == A[k + 1]);
    k = j - i;
    while (k) {
      x += k / 2;
      k /= 2;
    }
    res = ((res * fact[j - i]) % m * p2[x]) % m;
  }
  cout << res;
  return 0;
}
