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