#include <bits/stdc++.h>
using namespace std;
long long int f = 1, mod;
void calc(int sum, int t) {
  for (int i = 1; i <= sum; i++) {
    if (i % 2 or !t)
      f = (f * i) % mod;
    else
      f = (f * (i / 2)) % mod, t--;
  }
}
int main() {
  int n, p, count = 0, a[200001] = {0};
  cin >> n;
  vector<pair<int, int> > v;
  for (int i = 1; i <= n; i++) cin >> p, v.push_back(make_pair(p, i));
  for (int i = 1; i <= n; i++) cin >> p, v.push_back(make_pair(p, i));
  sort(v.begin(), v.end());
  int i = 0;
  cin >> mod;
  while (i < v.size()) {
    int t = 0, sum = 0;
    count++;
    a[v[i].second] = count;
    i++;
    while (i < 2 * n and v[i].first == v[i - 1].first) {
      if (a[v[i].second] == count) t++;
      a[v[i].second] = count;
      sum++;
      i++;
    }
    calc(sum + 1, t);
  }
  cout << f;
}
