#include <bits/stdc++.h>
using namespace std;
map<int, pair<long long, int> > mp;
int a[100005];
int b[100005];
long long m;
long long mix(pair<long long, int> p) {
  long long res = 1;
  long long i = 2;
  long long dup = p.second;
  for (; i <= p.first; i++) {
    long long c = i;
    while (dup > 0 && c % 2 == 0) {
      dup--;
      c /= 2;
    }
    res = (res * c) % m;
  }
  return res;
}
void add(int x, int dup) {
  map<int, pair<long long, int> >::iterator it = mp.find(x);
  if (it == mp.end()) {
    mp.insert(make_pair(x, make_pair(1, 0)));
  } else {
    it->second.first++;
    it->second.second += dup;
  }
}
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    add(a[i], 0);
  }
  for (int i = 0; i < n; i++) {
    cin >> b[i];
    if (b[i] == a[i]) {
      add(b[i], 1);
    } else
      add(b[i], 0);
  }
  cin >> m;
  map<int, pair<long long, int> >::iterator it = mp.begin();
  long long res = 1;
  for (; it != mp.end(); ++it) {
    res = (res * mix(it->second)) % m;
  }
  cout << res << endl;
  return 0;
}
