#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000100;
const int INF = 1e9 + 10;
int n;
long long a[maxn], b[maxn];
long long m;
map<long long, long long> cnt, Div;
long long cnt2[maxn], fac[maxn];
long long qpow(long long n, long long k, long long p) {
  long long res = 1;
  n %= p;
  while (k) {
    if (k & 1) res = (res * n) % p;
    n = (n * n) % p;
    k >>= 1;
  }
  return res;
}
void Init() {
  fac[0] = 1;
  cnt2[1] = 0;
  for (int i = 1; i <= maxn - 1; i++) {
    long long t = i;
    cnt2[i] = cnt2[i - 1];
    while (t % 2 == 0) cnt2[i]++, t /= 2;
    fac[i] = (fac[i - 1] * t) % m;
  }
}
int main() {
  while (cin >> n) {
    cnt.clear();
    Div.clear();
    for (int i = 1; i <= n; i++) scanf("%I64d", &a[i]), cnt[a[i]]++;
    for (int i = 1; i <= n; i++) scanf("%I64d", &b[i]), cnt[b[i]]++;
    for (int i = 1; i <= n; i++)
      if (a[i] == b[i]) Div[a[i]]++;
    cin >> m;
    Init();
    long long ans = 1, k2 = 0;
    for (map<long long, long long>::iterator it = cnt.begin(); it != cnt.end();
         ++it) {
      ans = (ans * fac[it->second]) % m;
      k2 += cnt2[it->second] - Div[it->first];
    }
    ans = (ans * qpow(2, k2, m)) % m;
    cout << ans << endl;
  }
  return 0;
}
