#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
pair<int, int> A[N];
int factorial[N];
int twos[N];
int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  for (int i = (int)0; i < (int)2 * n; i++) {
    cin >> A[i].first;
    A[i].second = i % n;
  }
  sort(A, A + 2 * n);
  int MOD;
  cin >> MOD;
  factorial[0] = 1;
  twos[0] = 0;
  for (int i = (int)1; i < (int)2 * n + 1; i++) {
    if (i % 2 == 0)
      twos[i] = 1 + twos[i / 2];
    else
      twos[i] = 0;
    int ti = i;
    while (ti % 2 == 0) ti /= 2;
    factorial[i] = (ti * (long long int)factorial[i - 1]) % MOD;
  }
  for (int i = (int)0; i < (int)2 * n; i++) twos[i + 1] += twos[i];
  n *= 2;
  int ans = 1;
  for (int i = 0; i < n;) {
    int endi = i;
    while (endi < n and A[endi].first == A[i].first) endi++;
    int numduplicates = 0;
    for (int j = (int)i; j < (int)endi; j++)
      if (j + 1 < endi and A[j].second == A[j + 1].second) numduplicates++;
    int len = endi - i;
    ans = (ans * (long long int)factorial[len]) % MOD;
    int ntwos = twos[len] - numduplicates;
    for (int x = (int)0; x < (int)ntwos; x++) {
      ans = (ans * 2) % MOD;
    }
    i = endi;
  }
  cout << ans << endl;
  return 0;
}
