#include <bits/stdc++.h>
using namespace std;
long long mod;
int n;
int a[100100], b[100100];
long long f[200100];
long long kol[200100];
long long tw[200100];
pair<int, int> help[200100];
int main() {
  cin >> n;
  for (int i = 0; i < int(n); i++) cin >> a[i];
  for (int i = 0; i < int(n); i++) cin >> b[i];
  cin >> mod;
  f[0] = 1;
  tw[0] = 1;
  for (int i = 1; i <= 2 * n; ++i) {
    int kol1 = 0, k = i;
    while (!(k & 1)) {
      k >>= 1;
      kol1++;
    }
    kol[i] = kol[i - 1] + kol1;
    f[i] = (1ll * f[i - 1] * k) % mod;
    tw[i] = (tw[i - 1] * 2) % mod;
  }
  for (int i = 0; i < int(n); i++) help[i] = make_pair(a[i], i);
  for (int i = 0; i < int(n); i++) help[i + n] = make_pair(b[i], i);
  sort(help, help + 2 * n);
  long long ans = 1;
  for (int i = 0; i < 2 * n;) {
    int j = i;
    int kol1 = 0;
    for (; j < 2 * n && help[i].first == help[j].first; ++j) {
      if (j != i && help[j - 1].second == help[j].second) kol1++;
    }
    ans = (ans * f[j - i]) % mod;
    ans = (ans * tw[kol[j - i] - kol1]) % mod;
    i = j;
  }
  cout << ans << endl;
  return 0;
}
