#include <bits/stdc++.h>
using namespace std;
long long Set(long long N, long long pos) { return N = N | (1 << pos); }
long long reset(long long N, long long pos) { return N = N & ~(1 << pos); }
bool check(long long N, long long pos) { return (bool)(N & (1 << pos)); }
void CI(long long &_x) { scanf("%I64d", &_x); }
void CO(long long &_x) { cout << _x; }
template <typename T>
void getarray(T a[], long long n) {
  for (long long i = 0; i < n; i++) cin >> a[i];
}
template <typename T>
void prLLIarray(T a[], long long n) {
  for (long long i = 0; i < n - 1; i++) cout << a[i] << " ";
  cout << a[n - 1] << endl;
}
const double EPS = 1e-9;
const long long INF = 0x7f7f7f7f;
long long dr8[8] = {1, -1, 0, 0, 1, -1, -1, 1};
long long dc8[8] = {0, 0, -1, 1, 1, 1, -1, -1};
long long dr4[4] = {0, 0, 1, -1};
long long dc4[4] = {-1, 1, 0, 0};
long long kn8r[8] = {1, 2, 2, 1, -1, -2, -2, -1};
long long kn8c[8] = {2, 1, -1, -2, -2, -1, 1, 2};
map<long long, long long> cnt;
vector<long long> A, B;
bool statue[100005];
vector<long long> prime;
void sieve() {
  memset(statue, true, sizeof statue);
  for (unsigned long long i = 3; i * i <= 100005; i += 2)
    if (statue[i] == true)
      for (unsigned long long j = i * i; j <= 100005; j += i + i)
        statue[j] = false;
  prime.push_back(2);
  for (unsigned long long i = 3; i <= 100005; i += 2)
    if (statue[i] == true) prime.push_back(i);
}
long long func(long long num, long long f) {
  long long k = 0;
  while (num > 0) {
    k += num / f;
    num = num / f;
  }
  return k;
}
long long factor[100005];
int main() {
  sieve();
  long long n;
  CI(n);
  for (long long i = 0; i < n; i++) {
    long long temp;
    CI(temp);
    cnt[temp]++;
    A.push_back(temp);
  }
  for (long long i = 0; i < n; i++) {
    long long temp;
    CI(temp);
    cnt[temp]++;
    B.push_back(temp);
  }
  long long kount_two = 0;
  for (long long i = 0; i < n; i++) {
    if (A[i] == B[i]) kount_two++;
  }
  vector<long long> V;
  map<long long, long long>::iterator it;
  for (it = cnt.begin(); it != cnt.end(); it++) {
    if (it->second > 1) V.push_back(it->second);
  }
  long long ans = 1, mod;
  cin >> mod;
  for (long long i = 0; i < V.size(); i++) {
    long long num = V[i];
    for (int j = 2; j <= num; j++) {
      long long temp = j;
      while (kount_two && temp % 2 == 0) {
        temp /= 2;
        kount_two--;
      }
      ans = (ans * temp) % mod;
    }
  }
  cout << ans << "\n";
}
