#include <bits/stdc++.h>
using namespace std;
int m;
int a[int(1e5 + 10)], b[int(1e5 + 10)];
int main() {
  int n;
  cin >> n;
  map<int, int> M;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    M[a[i]]++;
  }
  int p = 0;
  for (int i = 0; i < n; i++) {
    cin >> b[i];
    M[b[i]]++;
    if (a[i] == b[i]) {
      p++;
    }
  }
  cin >> m;
  map<int, int>::iterator it = M.begin();
  vector<int> v;
  for (it; it != M.end(); it++) {
    int l = it->second;
    for (long long int i = 1; i <= l; i++) {
      long long int now = i;
      while ((now % 2 == 0) && p > 0) {
        now /= 2;
        p--;
      }
      v.push_back(now);
    }
  }
  long long int ans = 1;
  int sz = v.size();
  for (int i = 0; i < sz; i++) {
    ans *= v[i];
    ans %= m;
  }
  cout << ans << endl;
}
