#include <bits/stdc++.h>
using namespace std;
long long a[100006], b[100005], fact[100005];
map<int, int> v, z;
int main() {
  int n;
  cin >> n;
  set<int> s;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    v[a[i]]++;
    s.insert(a[i]);
  }
  long long ans = 1;
  for (int i = 1; i <= n; i++) {
    cin >> b[i];
    v[b[i]]++;
    s.insert(b[i]);
    if (b[i] == a[i]) z[b[i]]++;
  }
  long long m;
  cin >> m;
  while (!s.empty()) {
    int h = *s.begin();
    s.erase(s.begin());
    long long d = 1;
    for (long long i = 2; i <= v[h]; i++) {
      long long t = i;
      while (z[h] > 0 && t % 2LL == 0) {
        t = t / 2LL;
        z[h]--;
      }
      d = d * t;
      d = d % m;
    }
    d = d % m;
    ans = ans * d;
    ans = ans % m;
  }
  ans = ans % m;
  cout << ans << '\n';
}
