#include <bits/stdc++.h>
using namespace std;
long long n, m, k, l = 1;
pair<int, int> a[200005];
long long fact(int cur, int rep) {
  long long res = 1;
  for (int i = 2; i <= cur; ++i) {
    int u = i;
    while (rep) {
      if (!(u % 2)) {
        u /= 2;
        --rep;
      } else
        break;
    }
    res = (res * u) % m;
  }
  return res % m;
}
int main() {
  cin >> n;
  long long res = 1;
  for (int i = 0; i < n; ++i) {
    scanf("%d", &a[i].first);
    a[i].second = i;
  }
  for (int i = n; i < 2 * n; ++i) {
    scanf("%d", &a[i].first);
    a[i].second = i - n;
  }
  sort(a, a + 2 * n);
  cin >> m;
  int ind = 0;
  int curv = a[ind].first, cur = 1, repeat = 0;
  for (int i = ind + 1; i < 2 * n; ++i) {
    if (a[i].first != curv) {
      res = (res * fact(cur, repeat)) % m;
      curv = a[i].first;
      cur = 1;
      repeat = 0;
    } else {
      if (a[i].second == a[i - 1].second) ++repeat;
      ++cur;
    }
  }
  if (cur > 1) res = (res * fact(cur, repeat)) % m;
  cout << res;
  return 0;
}
