#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:268435456")
using namespace std;
template <class T>
T sqr(T a) {
  return a * a;
}
map<int, int> a, b;
set<pair<int, int> > used;
long long f[200100];
long long p2[200100];
long long mod;
int n;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    int p;
    cin >> p;
    used.insert(make_pair(p, i));
    a[p]++;
  }
  for (int i = 0; i < n; i++) {
    int p;
    cin >> p;
    if (used.find(make_pair(p, i)) != used.end()) b[p]++;
    a[p]++;
  }
  cin >> mod;
  f[0] = p2[0] = 1;
  for (int i = 1; i <= n * 2; i++) {
    f[i] = f[i - 1] * (i % 2 ? i : i / 2) % mod;
    p2[i] = p2[i - 1] * 2 % mod;
  }
  long long result = 1;
  for (map<int, int>::iterator iter = a.begin(); iter != a.end(); iter++) {
    int dbl = b.find(iter->first) != b.end() ? b[iter->first] : 0;
    result = result * f[iter->second] % mod * p2[iter->second / 2 - dbl] % mod;
  }
  cout << result;
  return 0;
}
