#include <bits/stdc++.h>
using namespace std;
int mod;
unsigned long long work(vector<int> &x) {
  sort(x.begin(), x.end());
  int n = x.size();
  int m = x.end() - unique(x.begin(), x.end());
  unsigned long long ret = 1;
  for (int i = 2; i <= n; i++) {
    unsigned long long tmp = i;
    while (m > 0 && tmp % 2 == 0) tmp /= 2, m--;
    ret = ret * tmp % mod;
  }
  return ret;
}
int main() {
  vector<pair<int, int> > vec;
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    int a;
    scanf("%d", &a);
    vec.push_back(pair<int, int>(a, i));
  }
  for (int i = 0; i < n; i++) {
    int b;
    scanf("%d", &b);
    vec.push_back(pair<int, int>(b, i));
  }
  scanf("%d", &mod);
  sort(vec.begin(), vec.end());
  unsigned long long ans = 1;
  for (int i = 0; i < n + n;) {
    int nexti = i;
    vector<int> tmp;
    while (nexti < n + n && vec[i].first == vec[nexti].first) {
      tmp.push_back(vec[nexti].second);
      nexti++;
    }
    ans = ans * work(tmp) % mod;
    i = nexti;
  }
  printf("%d\n", (int)ans);
  return 0;
}
