#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/STACK:200000000")
const double EPS = 1E-9;
const int INF = 1000000000;
const long long INF64 = (long long)1E18;
const double PI = 3.1415926535897932384626433832795;
const int NMAX = 1100000;
pair<int, int> a[NMAX];
int b[NMAX];
long long fact[NMAX], fact2[NMAX], pow2[NMAX];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < (int)(n); i++) {
    scanf("%d", &a[i].first);
    a[i].second = i;
  }
  for (int i = 0; i < (int)(n); i++) {
    scanf("%d", &a[i + n].first);
    a[i + n].second = i;
  }
  long long m;
  cin >> m;
  fact[0] = 1;
  for (int i = 1; i < NMAX; i++) {
    int cur = i;
    fact2[i] = fact2[i - 1];
    while (cur % 2 == 0) {
      fact2[i]++;
      cur /= 2;
    }
    fact[i] = fact[i - 1] * cur % m;
  }
  pow2[0] = 1;
  for (int i = 1; i < NMAX; i++) pow2[i] = pow2[i - 1] * 2 % m;
  n *= 2;
  sort(a, a + n);
  long long ans = 1;
  for (int i = 0; i < (int)(n); i++) {
    int j = i;
    int cnt = 0;
    for (; j < n && a[i].first == a[j].first; j++) b[cnt++] = a[j].second;
    int dub = int(b + cnt - unique(b, b + cnt));
    long long cur = fact[cnt] * pow2[fact2[cnt] - dub] % m;
    ans = ans * cur % m;
    i = j - 1;
  }
  ans %= m;
  cout << ans << endl;
  return 0;
}
